[PATCH] D23819: [InstCombine] add assert and explanatory comment for fold removed in r279568; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 24 07:04:04 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279626: [InstCombine] add assert and explanatory comment for fold removed in r279568… (authored by spatel).
Changed prior to commit:
https://reviews.llvm.org/D23819?vs=69052&id=69114#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23819
Files:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
Index: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
===================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2041,6 +2041,13 @@
return Res;
}
+ // If the comparison constant changes with the shift, the comparison cannot
+ // succeed (bits of the comparison constant cannot match the shifted value).
+ // This should be known by InstSimplify and already be folded to true/false.
+ assert(((IsAShr && C->shl(ShAmtVal).ashr(ShAmtVal) == *C) ||
+ (!IsAShr && C->shl(ShAmtVal).lshr(ShAmtVal) == *C)) &&
+ "Expected icmp+shr simplify did not occur.");
+
// Check if the bits shifted out are known to be zero. If so, we can compare
// against the unshifted value:
// (X & 4) >> 1 == 2 --> (X & 4) == 4.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23819.69114.patch
Type: text/x-patch
Size: 902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160824/4964cb0d/attachment.bin>
More information about the llvm-commits
mailing list