Simon Jakobi pushed to branch wip/sjakobi/T26964 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/StgToCmm/Prim.hs
    ... ... @@ -96,9 +96,13 @@ cmmPrimOpApp cfg primop cmm_args mres_ty = do
    96 96
          -- if the result type isn't explicitly given, we directly use the
    
    97 97
          -- result type of the primop.
    
    98 98
          res_ty = fromMaybe (primOpResultType primop) mres_ty
    
    99
    -  -- Record the primop name so that any -fcheck-prim-bounds failure handler
    
    100
    -  -- emitted while compiling it can name it in the error message.
    
    101
    -  withCurrentPrimOpName (occNameString (primOpOcc primop)) (f res_ty)
    
    99
    +  -- When -fcheck-prim-bounds is on, record the primop name so that any
    
    100
    +  -- bounds-check failure handler emitted while compiling it can name it in the
    
    101
    +  -- error message. Guarded by the flag so that the common (unchecked) case pays
    
    102
    +  -- nothing: no name thunk, no FCodeState update.
    
    103
    +  if stgToCmmDoBoundsCheck cfg
    
    104
    +    then withCurrentPrimOpName (occNameString (primOpOcc primop)) (f res_ty)
    
    105
    +    else f res_ty
    
    102 106
     
    
    103 107
     externalPrimop :: PrimOp -> [CmmExpr] -> PrimopCmmEmit
    
    104 108
     externalPrimop primop args = outOfLinePrimop (callExternalPrimop primop args)