Skip to content

Commit 92fccea

Browse files
committed
Revert "[Reassociate] Use disjoint flag to convert Or to Add. (#72772)"
This reverts commit 7896445. Looks like I didn't rebase this correctly before commit
1 parent 7896445 commit 92fccea

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

llvm/lib/Transforms/Scalar/Reassociate.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,10 +2256,9 @@ void ReassociatePass::OptimizeInst(Instruction *I) {
22562256
// with no common bits set, convert it to X+Y.
22572257
if (I->getOpcode() == Instruction::Or &&
22582258
shouldConvertOrWithNoCommonBitsToAdd(I) && !isLoadCombineCandidate(I) &&
2259-
(I->isDisjoint() ||
2260-
haveNoCommonBitsSet(I->getOperand(0), I->getOperand(1),
2261-
SimplifyQuery(I->getModule()->getDataLayout(),
2262-
/*DT=*/nullptr, /*AC=*/nullptr, I)))) {
2259+
haveNoCommonBitsSet(I->getOperand(0), I->getOperand(1),
2260+
SimplifyQuery(I->getModule()->getDataLayout(),
2261+
/*DT=*/nullptr, /*AC=*/nullptr, I))) {
22632262
Instruction *NI = convertOrWithNoCommonBitsToAdd(I);
22642263
RedoInsts.insert(I);
22652264
MadeChange = true;

llvm/test/Transforms/Reassociate/add-like-or.ll

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,6 @@ define i32 @test3(i32 %x, i32 %bit) {
5959
ret i32 %res
6060
}
6161

62-
; Test that disjoint allow reassociation.
63-
define i32 @test4(i32 %a, i32 %b) {
64-
; CHECK-LABEL: @test4(
65-
; CHECK-NEXT: [[C:%.*]] = add i32 [[A:%.*]], 1
66-
; CHECK-NEXT: [[C_PLUS_ONE:%.*]] = add i32 [[C]], [[B:%.*]]
67-
; CHECK-NEXT: ret i32 [[C_PLUS_ONE]]
68-
;
69-
%c = or disjoint i32 %a, %b
70-
%c.plus.one = add i32 %c, 1
71-
ret i32 %c.plus.one
72-
}
73-
7462
declare i32 @llvm.ctlz.i32(i32, i1 immarg) #2
7563

7664
!0 = !{i32 0, i32 33}

0 commit comments

Comments
 (0)