Skip to content

Commit 5db1c6e

Browse files
committed
Revert "[InstCombine] Fix missed opportunity to fold 'or' into 'mul' operand. (#74225)"
This reverts commit e3b3c91. This is causing an infinite loop on stage 2 builds.
1 parent c000f75 commit 5db1c6e

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3394,7 +3394,7 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) {
33943394
// If the operands have no common bits set:
33953395
// or (mul X, Y), X --> add (mul X, Y), X --> mul X, (Y + 1)
33963396
if (match(&I,
3397-
m_c_Or(m_Value(X), m_OneUse(m_c_Mul(m_Deferred(X), m_Value(Y))))) &&
3397+
m_c_Or(m_OneUse(m_Mul(m_Value(X), m_Value(Y))), m_Deferred(X))) &&
33983398
haveNoCommonBitsSet(Op0, Op1, DL)) {
33993399
Value *IncrementY = Builder.CreateAdd(Y, ConstantInt::get(Ty, 1));
34003400
return BinaryOperator::CreateMul(X, IncrementY);

llvm/test/Transforms/InstCombine/or.ll

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,21 +1511,6 @@ define <2 x i12> @mul_no_common_bits_commute(<2 x i12> %p) {
15111511
ret <2 x i12> %r
15121512
}
15131513

1514-
define i32 @mul_no_common_bits_commute2(i32 %p1, i32 %p2) {
1515-
; CHECK-LABEL: @mul_no_common_bits_commute2(
1516-
; CHECK-NEXT: [[X:%.*]] = and i32 [[P1:%.*]], 7
1517-
; CHECK-NEXT: [[Y:%.*]] = shl i32 [[P2:%.*]], 3
1518-
; CHECK-NEXT: [[TMP1:%.*]] = or disjoint i32 [[Y]], 1
1519-
; CHECK-NEXT: [[R:%.*]] = mul i32 [[X]], [[TMP1]]
1520-
; CHECK-NEXT: ret i32 [[R]]
1521-
;
1522-
%x = and i32 %p1, 7
1523-
%y = shl i32 %p2, 3
1524-
%m = mul i32 %y, %x
1525-
%r = or i32 %m, %x
1526-
ret i32 %r
1527-
}
1528-
15291514
; negative test - extra use requires extra instructions
15301515

15311516
define i32 @mul_no_common_bits_uses(i32 %p1, i32 %p2) {

0 commit comments

Comments
 (0)