[llvm] [DSE] Consider the aliasing through global variable while checking clobber (PR #120044)

Haopeng Liu via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 12 23:02:04 PST 2025


================
@@ -2276,6 +2284,13 @@ DSEState::getInitializesArgMemLoc(const Instruction *I) {
       Inits = InitializesAttr.getValueAsConstantRangeList();
 
     Value *CurArg = CB->getArgOperand(Idx);
+    // Check whether "CurArg" could alias with global variables. We require
+    // either it's function local and isn't captured before or the "CB" only
+    // accesses arg or inaccessible mem.
+    if (!Inits.empty() && !isFuncLocalAndNotCaptured(CurArg, CB, EA) &&
+        !CB->onlyAccessesInaccessibleMemOrArgMem())
----------------
haopliu wrote:

Ah, thanks for the reminder! Done.

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


More information about the llvm-commits mailing list