Skip to content

Commit 17a34bf

Browse files
author
git apple-llvm automerger
committed
Merge commit '7c080e267722' from llvm.org/main into next
2 parents bf6407a + 7c080e2 commit 17a34bf

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4122,7 +4122,8 @@ bool llvm::recognizeBSwapOrBitReverseIdiom(
41224122
if (!MatchBSwaps && !MatchBitReversals)
41234123
return false;
41244124
Type *ITy = I->getType();
4125-
if (!ITy->isIntOrIntVectorTy() || ITy->getScalarSizeInBits() > 128)
4125+
if (!ITy->isIntOrIntVectorTy() || ITy->getScalarSizeInBits() == 1 ||
4126+
ITy->getScalarSizeInBits() > 128)
41264127
return false; // Can't do integer/elements > 128 bits.
41274128

41284129
// Try to find all the pieces corresponding to the bswap.

llvm/test/Transforms/InstCombine/or.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,3 +2035,15 @@ define i32 @or_xor_and_commuted3(i32 %x, i32 %y, i32 %z) {
20352035
%or1 = or i32 %xor, %yy
20362036
ret i32 %or1
20372037
}
2038+
2039+
define i1 @or_truncs(i8 %x) {
2040+
; CHECK-LABEL: @or_truncs(
2041+
; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[X:%.*]], 1
2042+
; CHECK-NEXT: [[OR1:%.*]] = icmp ne i8 [[TMP1]], 0
2043+
; CHECK-NEXT: ret i1 [[OR1]]
2044+
;
2045+
%trunc1 = trunc i8 %x to i1
2046+
%trunc2 = trunc i8 %x to i1
2047+
%or1 = or i1 %trunc1, %trunc2
2048+
ret i1 %or1
2049+
}

0 commit comments

Comments
 (0)