[PATCH] D11051: Extend LICM to hoist loop invariant GEP out

hfinkel at anl.gov hfinkel at anl.gov
Tue Jul 28 10:45:42 PDT 2015


hfinkel added inline comments.

================
Comment at: lib/Transforms/Scalar/LICM.cpp:1147
@@ +1146,3 @@
+    FirstGEP->setIsInBounds(true);
+  else
+    FirstGEP->setIsInBounds(false);
----------------
atrick wrote:
> I don't follow this comment. My reading of langref is that both the GEP's base and result must be inbounds. So if the first GEP is not inbounds and is the base of the second GEP, then the second GEP cannot be inbounds. (This is why I generally don't like this transformation.)
Andy is correct. The LangRef is clear on this matter, saying:

"If the inbounds keyword is present, the result value of the getelementptr is a poison value *if the base pointer* is not an in bounds address of an allocated object, or if any of the addresses..."

So you can't have inbounds on the second GEP either.



Repository:
  rL LLVM

http://reviews.llvm.org/D11051







More information about the llvm-commits mailing list