Skip to content

Commit

Permalink
[InstCombine] Drop poison generating flags on Or in simplifyAssocCast…
Browse files Browse the repository at this point in the history
…Assoc.

Fixes #74739.
  • Loading branch information
topperc committed Dec 7, 2023
1 parent c54cbf8 commit 09a05f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ static bool simplifyAssocCastAssoc(BinaryOperator *BinOp1,

IC.replaceOperand(*Cast, 0, BinOp2->getOperand(0));
IC.replaceOperand(*BinOp1, 1, FoldedC);
BinOp1->dropPoisonGeneratingFlags();
Cast->dropPoisonGeneratingFlags();
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/InstCombine/or.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1609,11 +1609,11 @@ define i8 @drop_disjoint(i8 %x) {
ret i8 %b
}

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

0 comments on commit 09a05f5

Please sign in to comment.