[llvm] [DSE] Handle provenance when eliminating tautological assignments (PR #184311)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 06:35:08 PST 2026


================
@@ -2275,6 +2276,12 @@ bool DSEState::dominatingConditionImpliesValue(MemoryDef *Def) {
       !ICmpInst::isEquality(Pred))
     return false;
 
+  // Ensure the replacement is allowed when comparing pointers, as
+  // the equality compares addresses only, not pointers' provenance.
+  if (StoreVal->getType()->isPointerTy() &&
+      !canReplacePointersIfEqual(ICmpL, StoreVal, DL))
----------------
antoniofrighetto wrote:

Right, thanks, was a bit perplexed that we should have introduced the ConstantPointerNull carveout here in DSE. Addressed separately.

https://github.com/llvm/llvm-project/pull/184311


More information about the llvm-commits mailing list