[InstCombine] add descriptive comments for tests; NFC

Also, remove unnecessary function attributes.

llvm-svn: 307930
This commit is contained in:
Sanjay Patel 2017-07-13 17:24:57 +00:00
parent f32f4be957
commit 6994530c37
1 changed files with 19 additions and 9 deletions

View File

@ -1,7 +1,9 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -instcombine < %s | FileCheck %s
define i32 @test1(i32 %x, i32 %y) nounwind {
; X | ~(X | Y) --> X | ~Y
define i32 @test1(i32 %x, i32 %y) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[Y_NOT:%.*]] = xor i32 %y, -1
; CHECK-NEXT: [[Z:%.*]] = or i32 [[Y_NOT]], %x
@ -13,7 +15,10 @@ define i32 @test1(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test2(i32 %x, i32 %y) nounwind {
; Commute (rename) the inner 'or' operands:
; Y | ~(X | Y) --> ~X | Y
define i32 @test2(i32 %x, i32 %y) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[X_NOT:%.*]] = xor i32 %x, -1
; CHECK-NEXT: [[Z:%.*]] = or i32 [[X_NOT]], %y
@ -25,7 +30,9 @@ define i32 @test2(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test3(i32 %x, i32 %y) nounwind {
; X | ~(X ^ Y) --> X | ~Y
define i32 @test3(i32 %x, i32 %y) {
; CHECK-LABEL: @test3(
; CHECK-NEXT: [[Y_NOT:%.*]] = xor i32 %y, -1
; CHECK-NEXT: [[Z:%.*]] = or i32 [[Y_NOT]], %x
@ -37,7 +44,10 @@ define i32 @test3(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test4(i32 %x, i32 %y) nounwind {
; Commute (rename) the 'xor' operands:
; Y | ~(X ^ Y) --> ~X | Y
define i32 @test4(i32 %x, i32 %y) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: [[X_NOT:%.*]] = xor i32 %x, -1
; CHECK-NEXT: [[Z:%.*]] = or i32 [[X_NOT]], %y
@ -49,7 +59,7 @@ define i32 @test4(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test5(i32 %x, i32 %y) nounwind {
define i32 @test5(i32 %x, i32 %y) {
; CHECK-LABEL: @test5(
; CHECK-NEXT: ret i32 -1
;
@ -59,7 +69,7 @@ define i32 @test5(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test6(i32 %x, i32 %y) nounwind {
define i32 @test6(i32 %x, i32 %y) {
; CHECK-LABEL: @test6(
; CHECK-NEXT: ret i32 -1
;
@ -69,7 +79,7 @@ define i32 @test6(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test7(i32 %x, i32 %y) nounwind {
define i32 @test7(i32 %x, i32 %y) {
; CHECK-LABEL: @test7(
; CHECK-NEXT: [[Z:%.*]] = or i32 %x, %y
; CHECK-NEXT: ret i32 [[Z]]
@ -79,7 +89,7 @@ define i32 @test7(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test8(i32 %x, i32 %y) nounwind {
define i32 @test8(i32 %x, i32 %y) {
; CHECK-LABEL: @test8(
; CHECK-NEXT: [[X_NOT:%.*]] = xor i32 %x, -1
; CHECK-NEXT: [[Z:%.*]] = or i32 [[X_NOT]], %y
@ -91,7 +101,7 @@ define i32 @test8(i32 %x, i32 %y) nounwind {
ret i32 %z
}
define i32 @test9(i32 %x, i32 %y) nounwind {
define i32 @test9(i32 %x, i32 %y) {
; CHECK-LABEL: @test9(
; CHECK-NEXT: [[Y_NOT:%.*]] = xor i32 %y, -1
; CHECK-NEXT: [[Z:%.*]] = or i32 [[Y_NOT]], %x