[llvm] r371311 - [SimplifyCFG][NFC] Autogenerate PhiEliminate3.ll
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 7 06:53:14 PDT 2019
Author: lebedevri
Date: Sat Sep 7 06:53:14 2019
New Revision: 371311
URL: http://llvm.org/viewvc/llvm-project?rev=371311&view=rev
Log:
[SimplifyCFG][NFC] Autogenerate PhiEliminate3.ll
Modified:
llvm/trunk/test/Transforms/SimplifyCFG/PhiEliminate3.ll
Modified: llvm/trunk/test/Transforms/SimplifyCFG/PhiEliminate3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/PhiEliminate3.ll?rev=371311&r1=371310&r2=371311&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/PhiEliminate3.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/PhiEliminate3.ll Sat Sep 7 06:53:14 2019
@@ -1,34 +1,83 @@
+; 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
+
; Test merging of blocks containing complex expressions,
; with various folding thresholds
-;
-; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=1 | grep N:
-; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=2 | not grep N:
-; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=2 | grep M:
-; RUN: opt < %s -simplifycfg -S -phi-node-folding-threshold=7 | not grep M:
-;
define i32 @test(i1 %a, i1 %b, i32 %i, i32 %j, i32 %k) {
+; CHECK-ONE-LABEL: @test(
+; CHECK-ONE-NEXT: entry:
+; CHECK-ONE-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
+; CHECK-ONE: O:
+; CHECK-ONE-NEXT: br i1 [[B:%.*]], label [[P:%.*]], label [[Q:%.*]]
+; CHECK-ONE: P:
+; CHECK-ONE-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
+; CHECK-ONE-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
+; CHECK-ONE-NEXT: br label [[N:%.*]]
+; CHECK-ONE: Q:
+; CHECK-ONE-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
+; CHECK-ONE-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
+; CHECK-ONE-NEXT: br label [[N]]
+; CHECK-ONE: N:
+; CHECK-ONE-NEXT: [[WP:%.*]] = phi i32 [ [[IAJAK]], [[P]] ], [ [[IXJXK]], [[Q]] ]
+; CHECK-ONE-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
+; CHECK-ONE-NEXT: br label [[M]]
+; CHECK-ONE: M:
+; CHECK-ONE-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[N]] ], [ 2, [[ENTRY:%.*]] ]
+; CHECK-ONE-NEXT: [[R:%.*]] = add i32 [[W]], 1
+; CHECK-ONE-NEXT: ret i32 [[R]]
+;
+; CHECK-TWO-LABEL: @test(
+; CHECK-TWO-NEXT: entry:
+; CHECK-TWO-NEXT: br i1 [[A:%.*]], label [[M:%.*]], label [[O:%.*]]
+; CHECK-TWO: O:
+; CHECK-TWO-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
+; CHECK-TWO-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
+; CHECK-TWO-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
+; CHECK-TWO-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
+; CHECK-TWO-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
+; CHECK-TWO-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
+; CHECK-TWO-NEXT: br label [[M]]
+; CHECK-TWO: M:
+; CHECK-TWO-NEXT: [[W:%.*]] = phi i32 [ [[WP2]], [[O]] ], [ 2, [[ENTRY:%.*]] ]
+; CHECK-TWO-NEXT: [[R:%.*]] = add i32 [[W]], 1
+; CHECK-TWO-NEXT: ret i32 [[R]]
+;
+; CHECK-SEVEN-LABEL: @test(
+; CHECK-SEVEN-NEXT: entry:
+; CHECK-SEVEN-NEXT: [[IAJ:%.*]] = add i32 [[I:%.*]], [[J:%.*]]
+; CHECK-SEVEN-NEXT: [[IAJAK:%.*]] = add i32 [[IAJ]], [[K:%.*]]
+; CHECK-SEVEN-NEXT: [[IXJ:%.*]] = xor i32 [[I]], [[J]]
+; CHECK-SEVEN-NEXT: [[IXJXK:%.*]] = xor i32 [[IXJ]], [[K]]
+; CHECK-SEVEN-NEXT: [[WP:%.*]] = select i1 [[B:%.*]], i32 [[IAJAK]], i32 [[IXJXK]]
+; CHECK-SEVEN-NEXT: [[WP2:%.*]] = add i32 [[WP]], [[WP]]
+; CHECK-SEVEN-NEXT: [[W:%.*]] = select i1 [[A:%.*]], i32 2, i32 [[WP2]]
+; CHECK-SEVEN-NEXT: [[R:%.*]] = add i32 [[W]], 1
+; CHECK-SEVEN-NEXT: ret i32 [[R]]
+;
entry:
- br i1 %a, label %M, label %O
+ br i1 %a, label %M, label %O
O:
- br i1 %b, label %P, label %Q
+ br i1 %b, label %P, label %Q
P:
- %iaj = add i32 %i, %j
- %iajak = add i32 %iaj, %k
- br label %N
+ %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
+ %ixj = xor i32 %i, %j
+ %ixjxk = xor i32 %ixj, %k
+ br label %N
N:
- ; This phi should be foldable if threshold >= 2
- %Wp = phi i32 [ %iajak, %P ], [ %ixjxk, %Q ]
- %Wp2 = add i32 %Wp, %Wp
- br label %M
+ ; This phi should be foldable if threshold >= 2
+ %Wp = phi i32 [ %iajak, %P ], [ %ixjxk, %Q ]
+ %Wp2 = add i32 %Wp, %Wp
+ br label %M
M:
- ; This phi should be foldable if threshold >= 7
- %W = phi i32 [ %Wp2, %N ], [ 2, %entry ]
- %R = add i32 %W, 1
- ret i32 %R
+ ; This phi should be foldable if threshold >= 7
+ %W = phi i32 [ %Wp2, %N ], [ 2, %entry ]
+ %R = add i32 %W, 1
+ ret i32 %R
}
More information about the llvm-commits
mailing list