[PATCH] D118387: [NFC][IPSCCP] Switch away from Instruction::isSafeToRemove()

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 11:28:39 PDT 2022


kpn added a comment.

I realized that going through isInstructionTriviallyDead() means it will handle constrained intrinsics differently than it does now. So this isn't strictly speaking an NFC change.



================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:98
+
+  return (!isa<CallInst>(I) || !I->mayHaveSideEffects()) && !I->isTerminator();
+}
----------------
sepavloff wrote:
> This check is almost the same as used by `Instruction::isSafeToRemove`, but the latter also checks for `isEHPad`. Why this check is omitted here? Would it be more consistent just to call `isSafeToRemove`?
I believe you are correct and this check should not have been omitted.

I'm trying to eliminate isSafeToRemove() since the Instruction class is the wrong place to do this check, and like the summary says, I don't want another implementation of isInstructionTriviallyDead().


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118387/new/

https://reviews.llvm.org/D118387



More information about the llvm-commits mailing list