[PATCH] D144563: [SimplifyCFG] Improve the precision of `PtrValueMayBeModified`

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 07:27:48 PST 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:7128
+        // getelementptr inbounds (TY, null, 0)        -> null
+        // getelementptr inbounds (TY, null, not zero) -> poison
+        if (!GEP->isInBounds() && !GEP->hasAllZeroIndices())
----------------
nikic wrote:
> This is only the case if `!NullPointerIsDefined(GEP->getFunction(), GEP->getPointerAddressSpace())`.
Though we should probably just move that check to the start of the function, because we end up repeating it everywhere anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144563



More information about the llvm-commits mailing list