[PATCH] D15146: [InstCombine] Look through PHIs, GEPs, IntToPtrs and PtrToInts to expose more constants when comparing GEPs
hfinkel@anl.gov via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 10 13:17:32 PST 2015
hfinkel added a subscriber: hfinkel.
================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:920
@@ +919,3 @@
+ // OFFSET1 cmp OFFSET2
+ Value *NewRHS = rewriteAsOffsetGEP(RHS, PtrBase, DL, Nodes);
+ return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Index, NewRHS);
----------------
For the particular ICmpInst you've creating here, is this `((gep Ptr, OFFSET1) cmp (gep Ptr, OFFSET2)` or `OFFSET1 cmp OFFSET2`? Given that rewriteAsOffsetGEP returns a GEP that uses PtrBase as its base address, it looks like for former. I see no reason it should not be the latter, however.
I think this would be clearer if you used the same names in your comments as you did names for the local variables.
http://reviews.llvm.org/D15146
More information about the llvm-commits
mailing list