[PATCH] D141089: [InstCombine] Fix potentially buggy code in `((%x & C) == 0) --> %x u< (-C)` transform
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 02:44:23 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe6375ca6dc5b: [InstCombine] Fix potentially buggy code in `((%x & C) == 0) --> %x u< (-C)`… (authored by goldstein.w.n, committed by nikic).
Herald added a subscriber: StephenFan.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141089/new/
https://reviews.llvm.org/D141089
Files:
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Index: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -1722,7 +1722,7 @@
APInt NewC2 = *C2;
KnownBits Know = computeKnownBits(And->getOperand(0), 0, And);
// Set high zeros of C2 to allow matching negated power-of-2.
- NewC2 = *C2 + APInt::getHighBitsSet(C2->getBitWidth(),
+ NewC2 = *C2 | APInt::getHighBitsSet(C2->getBitWidth(),
Know.countMinLeadingZeros());
// Restrict this fold only for single-use 'and' (PR10267).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141089.487355.patch
Type: text/x-patch
Size: 689 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230109/2926d777/attachment.bin>
More information about the llvm-commits
mailing list