[llvm] [SCCP] Consider provenance when propagating constant ptrs (PR #160083)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 22 06:15:16 PDT 2025
================
@@ -82,6 +83,26 @@ bool SCCPSolver::tryToReplaceWithConstant(Value *V) {
return false;
}
+ // Perform constant pointer propagation as long as assuming PredicateInfo
+ // derived equality between the two holds, and their provenance is the same.
+ if (auto *I = dyn_cast<Instruction>(V); I && I->getType()->isPointerTy()) {
+ if (getPredicateInfoFor(I)) {
----------------
nikic wrote:
Won't think not work if there any intermediate copies of the value? Like through a phi/select or in the IPSCCP case a function return value etc.
https://github.com/llvm/llvm-project/pull/160083
More information about the llvm-commits
mailing list