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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 01:05:14 PDT 2022


nikic added a comment.

This generally looks good to me, but I wonder whether it can be tested? I.e. does this allow eliminating (some) constrained FP intrinsics during SCCP and we can test that? Or does that require additional changes?



================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:101
+  // TODO: Teach wouldInstructionBeTriviallyDead() about loads of
+  // TODO: atomic globals that SCCP knows are effectively constant.
+  return isa<LoadInst>(I);
----------------
We can't really teach wouldInstructionBeTriviallyDead() about this because it requires SCCP-specific knowledge -- I think a more actionable TODO would be along these lines:

> TODO: Mark globals as being constant earlier, sowouldInstructionBeTriviallyDead() knows that atomic loads are safe to remove.


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

https://reviews.llvm.org/D118387



More information about the llvm-commits mailing list