1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[SimplifyCFG] Remove unused check-prefixes

This commit is contained in:
Simon Pilgrim 2020-11-09 10:36:46 +00:00
parent 30ab10645b
commit 431bb57974
5 changed files with 184 additions and 272 deletions

View File

@ -1,99 +1,55 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=4 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8M-TWO-FOLD-4
; RUN: opt -mtriple=armv8a < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=4 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8A-TWO-FOLD-4
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=5 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8M-TWO-FOLD-5
; RUN: opt -mtriple=armv8a < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=5 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8A-TWO-FOLD-5
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=6 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8M-TWO-FOLD-6
; RUN: opt -mtriple=armv8a < %s -simplifycfg -S -two-entry-phi-node-folding-threshold=6 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-V8A-TWO-FOLD-6
; RUN: opt -mtriple=thumbv8m.main < %s -simplifycfg -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 -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 -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 -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 -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 -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-V8M-TWO-FOLD-4-LABEL: @test_i32(
; 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: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i32 [[R]]
; 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-V8A-TWO-FOLD-4-LABEL: @test_i32(
; 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 i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-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-V8M-TWO-FOLD-5-LABEL: @test_i32(
; 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: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i32(
; 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 i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i32(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i32(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-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
@ -118,93 +74,49 @@ M:
}
define i32 @test_i32_minsize(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) #0 {
; CHECK-V8M-TWO-FOLD-4-LABEL: @test_i32_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: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-4-NEXT: ret i32 [[R]]
; 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-V8A-TWO-FOLD-4-LABEL: @test_i32_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 i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-4-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-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-V8M-TWO-FOLD-5-LABEL: @test_i32_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: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8M-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-5-LABEL: @test_i32_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 i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[WP2:%.*]] = add i32 [[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 i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-V8A-TWO-FOLD-5-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-5-NEXT: ret i32 [[R]]
;
; CHECK-V8M-TWO-FOLD-6-LABEL: @test_i32_minsize(
; CHECK-V8M-TWO-FOLD-6-NEXT: entry:
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8M-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8M-TWO-FOLD-6-NEXT: ret i32 [[R]]
;
; CHECK-V8A-TWO-FOLD-6-LABEL: @test_i32_minsize(
; CHECK-V8A-TWO-FOLD-6-NEXT: entry:
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
; CHECK-V8A-TWO-FOLD-6-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-V8A-TWO-FOLD-6-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

View File

@ -1,27 +1,27 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=1 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-ONE
; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=2 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-TWO
; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=7 | FileCheck %s --check-prefix=ALL --check-prefix=CHECK-SEVEN
; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=1 | FileCheck %s
; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=2 | FileCheck %s
; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=7 | FileCheck %s
; Test merging of blocks containing complex expressions,
; with various folding thresholds
define i32 @test(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) {
; ALL-LABEL: @test(
; ALL-NEXT: entry:
; ALL-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; ALL: O:
; ALL-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; ALL-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; ALL-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; ALL-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; ALL-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; ALL-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; ALL-NEXT: br label [[M]]
; ALL: M:
; ALL-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; ALL-NEXT: [[R:%.*]] = add i32 [[W]], 1
; ALL-NEXT: ret i32 [[R]]
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
; CHECK: O:
; CHECK-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
; CHECK-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
; CHECK-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
; CHECK-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
; CHECK-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
; CHECK-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
; CHECK-NEXT: br label [[M]]
; CHECK: M:
; CHECK-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
; CHECK-NEXT: [[R:%.*]] = add i32 [[W]], 1
; CHECK-NEXT: ret i32 [[R]]
;
entry:
br i1 %a, label %M, label %O

View File

@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -simplifycfg -hoist-common-insts=1 -S < %s | FileCheck %s --check-prefixes=HOIST
; RUN: opt -simplifycfg -hoist-common-insts=0 -S < %s | FileCheck %s --check-prefixes=NOHOIST
; RUN: opt -simplifycfg -S < %s | FileCheck %s --check-prefixes=NOHOIST,DEFAULT
; RUN: opt -simplifycfg -hoist-common-insts=1 -S < %s | FileCheck %s --check-prefix=HOIST
; RUN: opt -simplifycfg -hoist-common-insts=0 -S < %s | FileCheck %s --check-prefix=NOHOIST
; RUN: opt -simplifycfg -S < %s | FileCheck %s --check-prefix=NOHOIST
; This example is produced from a very basic C code:
;

View File

@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -simplifycfg < %s | FileCheck %s --check-prefix=ALL --check-prefix=EXPENSIVE
; RUN: opt -S -simplifycfg -speculate-one-expensive-inst=false < %s | FileCheck %s --check-prefix=ALL --check-prefix=CHEAP
; RUN: opt -S -simplifycfg < %s | FileCheck %s
; RUN: opt -S -simplifycfg -speculate-one-expensive-inst=false < %s | FileCheck %s
declare float @llvm.sqrt.f32(float) nounwind readonly
declare float @llvm.fma.f32(float, float, float) nounwind readonly
@ -12,12 +12,12 @@ declare float @llvm.minimum.f32(float, float) nounwind readonly
declare float @llvm.maximum.f32(float, float) nounwind readonly
define double @fdiv_test(double %a, double %b) {
; ALL-LABEL: @fdiv_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP:%.*]] = fcmp ogt double [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[DIV:%.*]] = fdiv double [[B:%.*]], [[A]]
; ALL-NEXT: [[COND:%.*]] = select nsz i1 [[CMP]], double [[DIV]], double 0.000000e+00
; ALL-NEXT: ret double [[COND]]
; CHECK-LABEL: @fdiv_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt double [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[DIV:%.*]] = fdiv double [[B:%.*]], [[A]]
; CHECK-NEXT: [[COND:%.*]] = select nsz i1 [[CMP]], double [[DIV]], double 0.000000e+00
; CHECK-NEXT: ret double [[COND]]
;
entry:
%cmp = fcmp ogt double %a, 0.0
@ -33,13 +33,13 @@ cond.end:
}
define void @sqrt_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
; ALL-LABEL: @sqrt_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.sqrt.f32(float [[A]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select afn i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @sqrt_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.sqrt.f32(float [[A]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select afn i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00
@ -56,13 +56,13 @@ test_sqrt.exit: ; preds = %cond.else.i, %entry
}
define void @fabs_test(float addrspace(1)* noalias nocapture %out, float %a) nounwind {
; ALL-LABEL: @fabs_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[A]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @fabs_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.fabs.f32(float [[A]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00
@ -79,13 +79,13 @@ test_fabs.exit: ; preds = %cond.else.i, %entry
}
define void @fma_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind {
; ALL-LABEL: @fma_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.fma.f32(float [[A]], float [[B:%.*]], float [[C:%.*]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select reassoc nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @fma_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.fma.f32(float [[A]], float [[B:%.*]], float [[C:%.*]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select reassoc nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00
@ -102,13 +102,13 @@ test_fma.exit: ; preds = %cond.else.i, %entry
}
define void @fmuladd_test(float addrspace(1)* noalias nocapture %out, float %a, float %b, float %c) nounwind {
; ALL-LABEL: @fmuladd_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.fmuladd.f32(float [[A]], float [[B:%.*]], float [[C:%.*]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select ninf i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @fmuladd_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.fmuladd.f32(float [[A]], float [[B:%.*]], float [[C:%.*]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select ninf i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00
@ -125,13 +125,13 @@ test_fmuladd.exit: ; preds = %cond.else.i, %en
}
define void @minnum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind {
; ALL-LABEL: @minnum_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.minnum.f32(float [[A]], float [[B:%.*]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @minnum_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.minnum.f32(float [[A]], float [[B:%.*]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00
@ -148,13 +148,13 @@ test_minnum.exit: ; preds = %cond.else.i, %ent
}
define void @maxnum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind {
; ALL-LABEL: @maxnum_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.maxnum.f32(float [[A]], float [[B:%.*]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select ninf nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @maxnum_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.maxnum.f32(float [[A]], float [[B:%.*]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select ninf nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00
@ -171,13 +171,13 @@ test_maxnum.exit: ; preds = %cond.else.i, %ent
}
define void @minimum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind {
; ALL-LABEL: @minimum_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.minimum.f32(float [[A]], float [[B:%.*]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @minimum_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.minimum.f32(float [[A]], float [[B:%.*]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select reassoc i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00
@ -194,13 +194,13 @@ test_minimum.exit: ; preds = %cond.else.i, %en
}
define void @maximum_test(float addrspace(1)* noalias nocapture %out, float %a, float %b) nounwind {
; ALL-LABEL: @maximum_test(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; ALL-NEXT: [[TMP0:%.*]] = tail call float @llvm.maximum.f32(float [[A]], float [[B:%.*]]) #2
; ALL-NEXT: [[COND_I:%.*]] = select nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; ALL-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; ALL-NEXT: ret void
; CHECK-LABEL: @maximum_test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP_I:%.*]] = fcmp olt float [[A:%.*]], 0.000000e+00
; CHECK-NEXT: [[TMP0:%.*]] = tail call float @llvm.maximum.f32(float [[A]], float [[B:%.*]]) #2
; CHECK-NEXT: [[COND_I:%.*]] = select nsz i1 [[CMP_I]], float 0x7FF8000000000000, float [[TMP0]]
; CHECK-NEXT: store float [[COND_I]], float addrspace(1)* [[OUT:%.*]], align 4
; CHECK-NEXT: ret void
;
entry:
%cmp.i = fcmp olt float %a, 0.000000e+00

View File

@ -1,21 +1,21 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -simplifycfg -S | FileCheck %s --check-prefixes=ALL,DEFAULT,FALLBACK0
; RUN: opt < %s -simplifycfg -phi-node-folding-threshold=2 -S | FileCheck %s --check-prefixes=ALL,DEFAULT,FALLBACK1
; RUN: opt < %s -simplifycfg -phi-node-folding-threshold=3 -S | FileCheck %s --check-prefixes=ALL,COSTLY
; RUN: opt < %s -simplifycfg -S | FileCheck %s
; RUN: opt < %s -simplifycfg -phi-node-folding-threshold=2 -S | FileCheck %s
; RUN: opt < %s -simplifycfg -phi-node-folding-threshold=3 -S | FileCheck %s
; This is checking that the multiplication does overflow, with a leftover
; guard against division-by-zero that was needed before InstCombine
; produced llvm.umul.with.overflow.
define i1 @will_overflow(i64 %size, i64 %nmemb) {
; ALL-LABEL: @will_overflow(
; ALL-NEXT: entry:
; ALL-NEXT: [[CMP:%.*]] = icmp eq i64 [[SIZE:%.*]], 0
; ALL-NEXT: [[UMUL:%.*]] = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 [[SIZE]], i64 [[NMEMB:%.*]])
; ALL-NEXT: [[UMUL_OV:%.*]] = extractvalue { i64, i1 } [[UMUL]], 1
; ALL-NEXT: [[UMUL_NOT_OV:%.*]] = xor i1 [[UMUL_OV]], true
; ALL-NEXT: [[TMP0:%.*]] = select i1 [[CMP]], i1 true, i1 [[UMUL_NOT_OV]]
; ALL-NEXT: ret i1 [[TMP0]]
; CHECK-LABEL: @will_overflow(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[SIZE:%.*]], 0
; CHECK-NEXT: [[UMUL:%.*]] = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 [[SIZE]], i64 [[NMEMB:%.*]])
; CHECK-NEXT: [[UMUL_OV:%.*]] = extractvalue { i64, i1 } [[UMUL]], 1
; CHECK-NEXT: [[UMUL_NOT_OV:%.*]] = xor i1 [[UMUL_OV]], true
; CHECK-NEXT: [[TMP0:%.*]] = select i1 [[CMP]], i1 true, i1 [[UMUL_NOT_OV]]
; CHECK-NEXT: ret i1 [[TMP0]]
;
entry:
%cmp = icmp eq i64 %size, 0