1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
Roman Lebedev 610e37f8c5 [SimplifyCFG] Teach FoldTwoEntryPHINode() to preserve DomTree
Still boring, simply drop all edges to successors of DomBlock,
and add an edge to to BB instead.
2020-12-20 00:18:33 +03:00

410 lines
20 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -two-entry-phi-node-folding-threshold=4 | FileCheck %s --check-prefixes=CHECK-TWO-FOLD-4,CHECK-V8M-TWO-FOLD-4
; RUN: opt -mtriple=armv8a < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -two-entry-phi-node-folding-threshold=4 | FileCheck %s --check-prefixes=CHECK-TWO-FOLD-4,CHECK-V8A-TWO-FOLD-4
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -two-entry-phi-node-folding-threshold=5 | FileCheck %s --check-prefixes=CHECK-TWO-FOLD-5,CHECK-V8M-TWO-FOLD-5
; RUN: opt -mtriple=armv8a < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -two-entry-phi-node-folding-threshold=5 | FileCheck %s --check-prefixes=CHECK-TWO-FOLD-5,CHECK-V8A-TWO-FOLD-5
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -two-entry-phi-node-folding-threshold=6 | FileCheck %s --check-prefixes=CHECK-TWO-FOLD-6,CHECK-V8M-TWO-FOLD-6
; RUN: opt -mtriple=armv8a < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S -two-entry-phi-node-folding-threshold=6 | FileCheck %s --check-prefixes=CHECK-TWO-FOLD-6,CHECK-V8A-TWO-FOLD-6
define i32 @test_i32(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) {
; CHECK-TWO-FOLD-4-LABEL: @test_i32(
; CHECK-TWO-FOLD-4-NEXT: entry:
; CHECK-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-TWO-FOLD-4: O:
; CHECK-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-TWO-FOLD-4: M:
; CHECK-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-TWO-FOLD-4-NEXT: ret i32 [[R]]
;
; CHECK-TWO-FOLD-5-LABEL: @test_i32(
; CHECK-TWO-FOLD-5-NEXT: entry:
; CHECK-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-TWO-FOLD-5: O:
; CHECK-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-TWO-FOLD-5: M:
; CHECK-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-TWO-FOLD-6-LABEL: @test_i32(
; CHECK-TWO-FOLD-6-NEXT: entry:
; CHECK-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i32 %i, %j
%iajak = add i32 %iaj, %k
br label %N
Q:
%ixj = xor i32 %i, %j
%ixjxk = xor i32 %ixj, %k
br label %N
N:
%Wp = phi i32 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i32 %Wp, %Wp
br label %M
M:
%W = phi i32 [ %Wp2, %N ], [ 2, %entry ]
%R = add i32 %W, 1
ret i32 %R
}
define i32 @test_i32_minsize(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) #0 {
; CHECK-TWO-FOLD-4-LABEL: @test_i32_minsize(
; CHECK-TWO-FOLD-4-NEXT: entry:
; CHECK-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-TWO-FOLD-4: O:
; CHECK-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-TWO-FOLD-4: M:
; CHECK-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-TWO-FOLD-4-NEXT: ret i32 [[R]]
;
; CHECK-TWO-FOLD-5-LABEL: @test_i32_minsize(
; CHECK-TWO-FOLD-5-NEXT: entry:
; CHECK-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-TWO-FOLD-5: O:
; CHECK-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-TWO-FOLD-5: M:
; CHECK-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-TWO-FOLD-6-LABEL: @test_i32_minsize(
; CHECK-TWO-FOLD-6-NEXT: entry:
; CHECK-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i32 %i, %j
%iajak = add i32 %iaj, %k
br label %N
Q:
%ixj = xor i32 %i, %j
%ixjxk = xor i32 %ixj, %k
br label %N
N:
%Wp = phi i32 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i32 %Wp, %Wp
br label %M
M:
%W = phi i32 [ %Wp2, %N ], [ 2, %entry ]
%R = add i32 %W, 1
ret i32 %R
}
define i64 @test_i64(i1 %a, i1 %b, i64 %i, i64 %j, i64 %k) {
; CHECK-V8M-TWO-FOLD-4-LABEL: @test_i64(
; CHECK-V8M-TWO-FOLD-4-NEXT: entry:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-4: O:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[B:%.*]], label [[P:%.*]], label [[Q:%.*]]
; CHECK-V8M-TWO-FOLD-4: P:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[N:%.*]]
; CHECK-V8M-TWO-FOLD-4: Q:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[N]]
; CHECK-V8M-TWO-FOLD-4: N:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = phi i64 [ [[IAJAK]], [[P]] ], [ [[IXJXK]], [[Q]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-4: M:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[N]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-4-LABEL: @test_i64(
; CHECK-V8A-TWO-FOLD-4-NEXT: entry:
; CHECK-V8A-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-4: O:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-4: M:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-5-LABEL: @test_i64(
; CHECK-V8M-TWO-FOLD-5-NEXT: entry:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-5: O:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[B:%.*]], label [[P:%.*]], label [[Q:%.*]]
; CHECK-V8M-TWO-FOLD-5: P:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[N:%.*]]
; CHECK-V8M-TWO-FOLD-5: Q:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[N]]
; CHECK-V8M-TWO-FOLD-5: N:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = phi i64 [ [[IAJAK]], [[P]] ], [ [[IXJXK]], [[Q]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-5: M:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[N]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i64(
; CHECK-V8A-TWO-FOLD-5-NEXT: entry:
; CHECK-V8A-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-5: O:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-5: M:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i64(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-6: O:
; CHECK-V8M-TWO-FOLD-6-NEXT: br i1 [[B:%.*]], label [[P:%.*]], label [[Q:%.*]]
; CHECK-V8M-TWO-FOLD-6: P:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: br label [[N:%.*]]
; CHECK-V8M-TWO-FOLD-6: Q:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: br label [[N]]
; CHECK-V8M-TWO-FOLD-6: N:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = phi i64 [ [[IAJAK]], [[P]] ], [ [[IXJXK]], [[Q]] ]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-6: M:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[N]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i64(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i64 2, i64 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i64 %i, %j
%iajak = add i64 %iaj, %k
br label %N
Q:
%ixj = xor i64 %i, %j
%ixjxk = xor i64 %ixj, %k
br label %N
N:
%Wp = phi i64 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i64 %Wp, %Wp
br label %M
M:
%W = phi i64 [ %Wp2, %N ], [ 2, %entry ]
%R = add i64 %W, 1
ret i64 %R
}
define i64 @test_i64_minsize(i1 %a, i1 %b, i64 %i, i64 %j, i64 %k) #0 {
; CHECK-V8M-TWO-FOLD-4-LABEL: @test_i64_minsize(
; CHECK-V8M-TWO-FOLD-4-NEXT: entry:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-4: O:
; CHECK-V8M-TWO-FOLD-4-NEXT: br i1 [[B:%.*]], label [[P:%.*]], label [[Q:%.*]]
; CHECK-V8M-TWO-FOLD-4: P:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[N:%.*]]
; CHECK-V8M-TWO-FOLD-4: Q:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[N]]
; CHECK-V8M-TWO-FOLD-4: N:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = phi i64 [ [[IAJAK]], [[P]] ], [ [[IXJXK]], [[Q]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-4: M:
; CHECK-V8M-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[N]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-4-LABEL: @test_i64_minsize(
; CHECK-V8A-TWO-FOLD-4-NEXT: entry:
; CHECK-V8A-TWO-FOLD-4-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-4: O:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-4-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-4: M:
; CHECK-V8A-TWO-FOLD-4-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-4-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-5-LABEL: @test_i64_minsize(
; CHECK-V8M-TWO-FOLD-5-NEXT: entry:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-5: O:
; CHECK-V8M-TWO-FOLD-5-NEXT: br i1 [[B:%.*]], label [[P:%.*]], label [[Q:%.*]]
; CHECK-V8M-TWO-FOLD-5: P:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[N:%.*]]
; CHECK-V8M-TWO-FOLD-5: Q:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[N]]
; CHECK-V8M-TWO-FOLD-5: N:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = phi i64 [ [[IAJAK]], [[P]] ], [ [[IXJXK]], [[Q]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-5: M:
; CHECK-V8M-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[N]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i64_minsize(
; CHECK-V8A-TWO-FOLD-5-NEXT: entry:
; CHECK-V8A-TWO-FOLD-5-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8A-TWO-FOLD-5: O:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-5-NEXT: br label [[M]]
; CHECK-V8A-TWO-FOLD-5: M:
; CHECK-V8A-TWO-FOLD-5-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i64 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i64_minsize(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK-V8M-TWO-FOLD-6: O:
; CHECK-V8M-TWO-FOLD-6-NEXT: br i1 [[B:%.*]], label [[P:%.*]], label [[Q:%.*]]
; CHECK-V8M-TWO-FOLD-6: P:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: br label [[N:%.*]]
; CHECK-V8M-TWO-FOLD-6: Q:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: br label [[N]]
; CHECK-V8M-TWO-FOLD-6: N:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = phi i64 [ [[IAJAK]], [[P]] ], [ [[IXJXK]], [[Q]] ]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: br label [[M]]
; CHECK-V8M-TWO-FOLD-6: M:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = phi i64 [ [[WP2]], [[N]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i64_minsize(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i64 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i64 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i64 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i64 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i64 [[IAJAK]], i64 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i64 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i64 2, i64 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i64 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-NEXT: ret i64 [[R]]
;
entry:
br i1 %a, label %M, label %O
O:
br i1 %b, label %P, label %Q
P:
%iaj = add i64 %i, %j
%iajak = add i64 %iaj, %k
br label %N
Q:
%ixj = xor i64 %i, %j
%ixjxk = xor i64 %ixj, %k
br label %N
N:
%Wp = phi i64 [ %iajak, %P ], [ %ixjxk, %Q ]
%Wp2 = add i64 %Wp, %Wp
br label %M
M:
%W = phi i64 [ %Wp2, %N ], [ 2, %entry ]
%R = add i64 %W, 1
ret i64 %R
}
attributes #0 = { minsize optsize }