Skip to content

Commit

Permalink
[InstSimplify] Add tests that fold instructions with poison operands …
Browse files Browse the repository at this point in the history
…(NFC)
  • Loading branch information
aqjune committed Dec 1, 2020
1 parent 735e6c8 commit 864dda5
Show file tree
Hide file tree
Showing 23 changed files with 920 additions and 9 deletions.
10 changes: 8 additions & 2 deletions llvm/test/Transforms/InstSimplify/add.ll
Expand Up @@ -30,7 +30,7 @@ define <2 x i32> @negated_operand_commute_vec(<2 x i32> %x) {

define i8 @knownnegation(i8 %x, i8 %y) {
; CHECK-LABEL: @knownnegation(
; CHECK-NEXT: ret i8 0
; CHECK-NEXT: ret i8 0
;
%xy = sub i8 %x, %y
%yx = sub i8 %y, %x
Expand All @@ -48,4 +48,10 @@ define <2 x i8> @knownnegation_commute_vec(<2 x i8> %x, <2 x i8> %y) {
ret <2 x i8> %r
}


define i32 @poison(i32 %x) {
; CHECK-LABEL: @poison(
; CHECK-NEXT: ret i32 poison
;
%y = add i32 %x, poison
ret i32 %y
}
12 changes: 12 additions & 0 deletions llvm/test/Transforms/InstSimplify/and.ll
@@ -0,0 +1,12 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s

; TODO: this should be poison

define i32 @poison(i32 %x) {
; CHECK-LABEL: @poison(
; CHECK-NEXT: ret i32 0
;
%v = and i32 %x, poison
ret i32 %v
}

0 comments on commit 864dda5

Please sign in to comment.