[PATCH] D145854: [GlobalDCE] Don't add dependency via icmp against inbouds pointer

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 22:53:40 PDT 2023


StephenFan added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalDCE.cpp:102
+        if (Op0->getType()->isPointerTy() &&
+            (isLocalGlobal(Op0) || isLocalGlobal(Op1)) &&
+            isDereferenceableOrNull(Op0, DL) &&
----------------
Your `isDereferenceableOrNull` function can handle the `GetElementPtr` instruction, but `isLocalGlobal` can not handle `GetElementPtr`. Maybe we need to call `stripInBoundsOffsets` on `Op0` and `Op1`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145854



More information about the llvm-commits mailing list