[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 Dec 22 09:48:13 PST 2024


================
@@ -2261,6 +2261,19 @@ struct DSEState {
   bool eliminateDeadDefs(const MemoryDefWrapper &KillingDefWrapper);
 };
 
+// Return true if "Arg" is function local and isn't captured before "CB" or
+// if "Arg" is GEP whose base pointer is function local and isn't captured
+// before "CB".
+bool IsFuncLocalAndNotCaptured(Value *Arg, const CallBase *CB,
+                               EarliestEscapeAnalysis &EA) {
+  if (isIdentifiedFunctionLocal(Arg))
+    return EA.isNotCapturedBefore(Arg, CB, /*OrAt*/ true);
+  const auto *GEP = dyn_cast<GetElementPtrInst>(Arg);
----------------
haopliu wrote:

Ah, done. Thanks!

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


More information about the llvm-commits mailing list