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

Lawrence Hu lawrence at codeaurora.org
Tue Jul 28 10:11:11 PDT 2015


hulx2000 added inline comments.

================
Comment at: lib/Transforms/Scalar/LICM.cpp:1147
@@ +1146,2 @@
+    FirstGEP->setIsInBounds(true);
+}
----------------
hfinkel wrote:
> But you also need to set inbounds to false is the offset is larger than the size (even if the original GEP was inbounds). You need to set the inbounds on the second GEP to false.
Thanks Hal.

The second GEP should be safe to have whatever inbound attribute as before,  since originally the first is p+o, the second is p+o+c,  now the first is p+c, the second is p+c+o==p+o+c.


Repository:
  rL LLVM

http://reviews.llvm.org/D11051







More information about the llvm-commits mailing list