[PATCH] D114889: [GlobalOpt] Simplify CleanupConstantGlobalUsers()

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 1 11:24:38 PST 2021


aeubanks accepted this revision.
aeubanks added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:307
+      // A load from zeroinitializer is always zeroinitializer, regardless of
+      // any applied offset.
+      if (Init->isNullValue()) {
----------------
nikic wrote:
> aeubanks wrote:
> > is this true for non-inbounds GEPs?
> Yes, because the result is either zero or the load is UB. This is similar to the logic in https://github.com/llvm/llvm-project/blob/b1bc627e7e9965e6ec15e106ee4b2c21f6c36923/llvm/lib/Analysis/ConstantFolding.cpp#L704.
ah the langref clears that up, thanks


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

https://reviews.llvm.org/D114889



More information about the llvm-commits mailing list