[PATCH] D33737: [InstSimplify] Don't constant fold or DCE calls that are marked nobuiltin

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 15:06:25 PDT 2017


andrew.w.kaylor added a comment.

In https://reviews.llvm.org/D33737#769217, @efriedma wrote:

> Would it be possible to pass in a CallSite to canConstantFoldCallTo, ConstantFoldCall, and SimplifyCall, to reduce the number of places we check this?


It's certainly possible.  The reason I didn't do it was that I didn't want to make assumptions about how the existing functions might be used.  They all seem to have deliberately avoided passing the actual call instruction as an argument.  In the case of canConstantFoldCallTo it seems like the function is answering the abstract question of can calls to this Function be folded.  Including the CallSite changes the semantics of the function, though it is arguably an improvement.  In the case of ConstantFoldCall and SimplifyCall the expectation seems to be that they will construct the result of folding the given call, if possible, and the caller will be responsible for making actual changes to the active IR.

That said, I would favor including the CallSite in these calls if there are no objections because the current implementation is definitely vulnerable to future errors.


Repository:
  rL LLVM

https://reviews.llvm.org/D33737





More information about the llvm-commits mailing list