Skip to content

Commit

Permalink
[LogicCombine] Rename test file complex-logic.ll to logic-combine.ll;…
Browse files Browse the repository at this point in the history
… NFC
  • Loading branch information
bcl5980 committed Feb 23, 2023
1 parent a81bdc6 commit 0c3411b
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 214 deletions.
214 changes: 0 additions & 214 deletions llvm/test/Transforms/AggressiveInstCombine/complex-logic.ll

This file was deleted.

165 changes: 165 additions & 0 deletions llvm/test/Transforms/AggressiveInstCombine/logic-combine.ll
@@ -0,0 +1,165 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=aggressive-instcombine -S | FileCheck %s

define i8 @leaf1_and_aa(i8 %a) {
; CHECK-LABEL: @leaf1_and_aa(
; CHECK-NEXT: ret i8 [[A:%.*]]
;
%and.aa = and i8 %a, %a
ret i8 %and.aa
}

define i8 @leaf1_and_a_false(i8 %a) {
; CHECK-LABEL: @leaf1_and_a_false(
; CHECK-NEXT: ret i8 0
;
%and.aa = and i8 %a, 0
ret i8 %and.aa
}

define i8 @leaf1_xor_aa(i8 %a) {
; CHECK-LABEL: @leaf1_xor_aa(
; CHECK-NEXT: ret i8 0
;
%xor.aa = xor i8 %a, %a
ret i8 %xor.aa
}

define i8 @leaf1_and_not(i8 %a) {
; CHECK-LABEL: @leaf1_and_not(
; CHECK-NEXT: ret i8 0
;
%not.a = xor i8 %a, -1
%and = and i8 %a, %not.a
ret i8 %and
}

define i8 @leaf1_or_not(i8 %a) {
; CHECK-LABEL: @leaf1_or_not(
; CHECK-NEXT: ret i8 -1
;
%not.a = xor i8 %a, -1
%or = or i8 %a, %not.a
ret i8 %or
}

define i8 @leaf2_xor(i8 %a, i8 %b) {
; CHECK-LABEL: @leaf2_xor(
; CHECK-NEXT: ret i8 [[B:%.*]]
;
%ab = xor i8 %a, %b
%xor.ab.a = xor i8 %ab, %a
ret i8 %xor.ab.a
}

define i8 @leaf2_xor_ret_const_false(i8 %a, i8 %b) {
; CHECK-LABEL: @leaf2_xor_ret_const_false(
; CHECK-NEXT: ret i8 0
;
%xor.ab = xor i8 %a, %b
%xor.ab.a = xor i8 %xor.ab, %a
%xor.ab.a.b = xor i8 %xor.ab.a, %b
ret i8 %xor.ab.a.b
}

define i8 @leaf2_or_ret_leaf(i8 %a, i8 %b) {
; CHECK-LABEL: @leaf2_or_ret_leaf(
; CHECK-NEXT: ret i8 [[B:%.*]]
;
%or.ab = or i8 %a, %b
%and.ab = and i8 %a, %b
%xor1 = xor i8 %or.ab, %and.ab
%xor2 = xor i8 %xor1, %a
ret i8 %xor2
}

define i8 @leaf2_or_ret_const_false(i8 %a, i8 %b) {
; CHECK-LABEL: @leaf2_or_ret_const_false(
; CHECK-NEXT: ret i8 [[A:%.*]]
;
%or.ab = or i8 %a, %b
%and.ab = and i8 %a, %b
%xor1 = xor i8 %or.ab, %and.ab
%xor2 = xor i8 %xor1, %a
%xor3 = xor i8 %xor1, %b
ret i8 %xor3
}

define i1 @leaf2_type_is_i1(i1 %a, i1 %b) {
; CHECK-LABEL: @leaf2_type_is_i1(
; CHECK-NEXT: ret i1 true
;
%xor.ab = xor i1 %a, %b
%not.a = xor i1 %a, true
%xor2 = xor i1 %not.a, %b
%or = or i1 %xor2, %xor.ab
ret i1 %or
}

define i8 @leaf3_complex_ret_const_false(i8 %a, i8 %b, i8 %c) {
; CHECK-LABEL: @leaf3_complex_ret_const_false(
; CHECK-NEXT: ret i8 0
;
%ab = or i8 %a, %b
%abc = or i8 %ab, %c
%not.abc = xor i8 %abc, -1
%r = and i8 %not.abc, %a
ret i8 %r
}

define i8 @leaf3_complex_ret_leaf(i8 %a, i8 %b, i8 %c) {
; CHECK-LABEL: @leaf3_complex_ret_leaf(
; CHECK-NEXT: ret i8 [[C:%.*]]
;
%ab = and i8 %a, %b
%bc = and i8 %b, %c
%xor.ac = xor i8 %a, %c
%or = or i8 %ab, %xor.ac
%not.bc = xor i8 %bc, -1
%and = and i8 %not.bc, %a
%cond = xor i8 %and, %or
ret i8 %cond
}

define i8 @leaf4_ret_const_true(i8 %a, i8 %b, i8 %c, i8 %d) {
; CHECK-LABEL: @leaf4_ret_const_true(
; CHECK-NEXT: ret i8 -1
;
%bd = and i8 %b, %d
%not.bd = xor i8 %bd, -1
%xor.ab = xor i8 %a, %b
%or1 = or i8 %xor.ab, %c
%or2 = or i8 %or1, %not.bd
%or3 = or i8 %or2, %a
ret i8 %or3
}

define i8 @leaf4_ret_leaf(i8 %a, i8 %b, i8 %c, i8 %d) {
; CHECK-LABEL: @leaf4_ret_leaf(
; CHECK-NEXT: ret i8 [[B:%.*]]
;
%bd = and i8 %b, %d
%xor = xor i8 %bd, %c
%not.bd = xor i8 %xor, -1
%xor.ab = xor i8 %a, %b
%or1 = or i8 %xor.ab, %c
%or2 = or i8 %or1, %not.bd
%or3 = or i8 %or2, %a
%and = and i8 %or3, %b
ret i8 %and
}

define i8 @leaf4_ret_leaf2(i8 %a, i8 %b, i8 %c, i8 %d) {
; CHECK-LABEL: @leaf4_ret_leaf2(
; CHECK-NEXT: ret i8 [[B:%.*]]
;
%bd = and i8 %b, %d
%xor = xor i8 %bd, %c
%not.bd = xor i8 %xor, -1
%xor.ab = xor i8 %a, %b
%or1 = or i8 %xor.ab, %c
%or2 = or i8 %or1, %not.bd
%or3 = or i8 %or2, %a
%and = and i8 %or3, %b
ret i8 %and
}

0 comments on commit 0c3411b

Please sign in to comment.