Skip to content

Commit

Permalink
[InstCombine] Add test for #89669 (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Apr 23, 2024
1 parent e7efd37 commit ff153bd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions llvm/test/Transforms/InstCombine/sub-of-negatible.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,19 @@ define i8 @dont_negate_ordinary_select(i8 %x, i8 %y, i8 %z, i1 %c) {
ret i8 %t1
}

; FIXME: This is a miscompile.
define <2 x i32> @negate_select_of_negation_poison(<2 x i1> %c, <2 x i32> %x) {
; CHECK-LABEL: @negate_select_of_negation_poison(
; CHECK-NEXT: [[NEG:%.*]] = sub <2 x i32> <i32 0, i32 poison>, [[X:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = select <2 x i1> [[C:%.*]], <2 x i32> [[X]], <2 x i32> [[NEG]]
; CHECK-NEXT: ret <2 x i32> [[TMP1]]
;
%neg = sub <2 x i32> <i32 0, i32 poison>, %x
%sel = select <2 x i1> %c, <2 x i32> %neg, <2 x i32> %x
%neg2 = sub <2 x i32> zeroinitializer, %sel
ret <2 x i32> %neg2
}

; Freeze is transparent as far as negation is concerned
define i4 @negate_freeze(i4 %x, i4 %y, i4 %z) {
; CHECK-LABEL: @negate_freeze(
Expand Down

0 comments on commit ff153bd

Please sign in to comment.