[PATCH] D144476: [GlobalOpt] Extend logic in SRA heuristic to skip stores of initializer.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 03:11:41 PST 2023


fhahn marked 2 inline comments as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:400
+
+        auto *GlobalVar = dyn_cast<GlobalVariable>(GV);
+        Constant *StoredConst = dyn_cast<Constant>(SI->getOperand(0));
----------------
nikic wrote:
> Rebase over https://github.com/llvm/llvm-project/commit/0ecef88cb167dbd19023a932e7abac09059c3e4e?
Done!


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:408
+               !(StoredConst->isNullValue() &&
+                 GlobalVar->getInitializer()->isNullValue());
+      };
----------------
nikic wrote:
> Shouldn't we be comparing with the initializer at the specific offset?
Yeah, I updated the code to use ConstantFoldLoadFromConst


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144476



More information about the llvm-commits mailing list