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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 09:03:43 PDT 2019


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2351
+          DerefBytes >= EltBitWidth / 8)
+        GEP->setIsInBounds();
+      return GEP;
----------------
Why all this logic? `bitcast` -> `gep inbounds 0, 0` should be fine as long as the pointer is `null` or points into (or to the end of) an allocated object.

@lebedev.ri 
We can add an attribute to add `inbounds` to GEPs if we determine the above condition easily, I'll keep you posted. Open a bug if you want to make sure ;)


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

https://reviews.llvm.org/D68244





More information about the llvm-commits mailing list