[PATCH] D38856: [IPSCCP] Remove calls without side effects
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 13:00:21 PDT 2017
sanjoy added inline comments.
================
Comment at: lib/Transforms/Scalar/SCCP.cpp:1929
if (tryToReplaceWithConstant(Solver, Inst)) {
- if (!isa<CallInst>(Inst) && !isa<TerminatorInst>(Inst))
+ if ((!isa<CallInst>(Inst) || !Inst->mayHaveSideEffects()) &&
+ !isa<TerminatorInst>(Inst))
----------------
Can we just make this `!Inst->mayHaveSideEffects() && !isa<TerminatorInst>(Inst)`? Otherwise we're assuming that non-calls that aren't terminators are not side effecting, which may be correct specifically for the instructions that `tryToReplaceWithConstant` returns true for, but isn't true in general.
https://reviews.llvm.org/D38856
More information about the llvm-commits
mailing list