Skip to content

Commit 09a05f5

Browse files
committed
[InstCombine] Drop poison generating flags on Or in simplifyAssocCastAssoc.
Fixes #74739.
1 parent c54cbf8 commit 09a05f5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ static bool simplifyAssocCastAssoc(BinaryOperator *BinOp1,
356356

357357
IC.replaceOperand(*Cast, 0, BinOp2->getOperand(0));
358358
IC.replaceOperand(*BinOp1, 1, FoldedC);
359+
BinOp1->dropPoisonGeneratingFlags();
359360
Cast->dropPoisonGeneratingFlags();
360361
return true;
361362
}

llvm/test/Transforms/InstCombine/or.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,11 +1609,11 @@ define i8 @drop_disjoint(i8 %x) {
16091609
ret i8 %b
16101610
}
16111611

1612-
; FIXME: We should drop disjoint here.
1612+
; Make sure we drop disjoint when combining the Ors.
16131613
define i32 @assoc_cast_assoc_disjoint(i16 %x) {
16141614
; CHECK-LABEL: @assoc_cast_assoc_disjoint(
16151615
; CHECK-NEXT: [[B:%.*]] = zext i16 [[X:%.*]] to i32
1616-
; CHECK-NEXT: [[C:%.*]] = or disjoint i32 [[B]], 65537
1616+
; CHECK-NEXT: [[C:%.*]] = or i32 [[B]], 65537
16171617
; CHECK-NEXT: ret i32 [[C]]
16181618
;
16191619
%a = or i16 %x, 1

0 commit comments

Comments
 (0)