[PATCH] D68244: [InstCombine] don't assume 'inbounds' for bitcast pointer to GEP transform (PR43501)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 07:17:00 PDT 2019


lebedev.ri added subscribers: uenoku, sstefan1, lebedev.ri.
lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2344-2345
+
+      // If the source pointer is known to be dereferenceable beyond the length
+      // of the destination type, then we can apply "inbounds" to the GEP.
+      bool CanBeNull;
----------------
Why beyond? You check `>=`.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2351
+          DerefBytes >= EltBitWidth / 8)
+        GEP->setIsInBounds();
+      return GEP;
----------------
@jdoerfert @uenoku @sstefan1 
attributor potential missing feature: i'd expect that it could set this `inbounds`, but it does not: https://godbolt.org/z/zkUt1-


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

https://reviews.llvm.org/D68244





More information about the llvm-commits mailing list