[PATCH] D19390: folding compares for distinct allocations
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 07:22:58 PDT 2016
majnemer added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1905-1909
@@ -1902,2 +1904,7 @@
unsigned OtherIndex = (ICI->getOperand(0) == PI) ? 1 : 0;
- if (!isNeverEqualToUnescapedAlloc(ICI->getOperand(OtherIndex)))
+ // We avoid the case of allocation being compared to itself.
+ // Strip off pointer and zero GEPs
+ if (PI ==
+ ICI->getOperand(OtherIndex)
+ ->stripPointerCastsNoFollowAliases() ||
+ !isNeverEqualToUnescapedAlloc(ICI->getOperand(OtherIndex), TLI))
----------------
I don't think this will do the right thing if `%x = allocation` is compared with `gep(gep(%x, 1), -1)`.
http://reviews.llvm.org/D19390
More information about the llvm-commits
mailing list