[llvm-branch-commits] [llvm] 4fc9080 - [NFC][SimplifyCFG] Add a test where we fail to preserve DomTree validity
Roman Lebedev via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Jan 3 14:07:12 PST 2021
Author: Roman Lebedev
Date: 2021-01-04T01:02:01+03:00
New Revision: 4fc908025fd003a7517e392f35389364fb60500d
URL: https://github.com/llvm/llvm-project/commit/4fc908025fd003a7517e392f35389364fb60500d
DIFF: https://github.com/llvm/llvm-project/commit/4fc908025fd003a7517e392f35389364fb60500d.diff
LOG: [NFC][SimplifyCFG] Add a test where we fail to preserve DomTree validity
Added:
llvm/test/Transforms/SimplifyCFG/SimplifyTerminatorOnSelect-domtree-preservation-edgecase.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/SimplifyTerminatorOnSelect-domtree-preservation-edgecase.ll b/llvm/test/Transforms/SimplifyCFG/SimplifyTerminatorOnSelect-domtree-preservation-edgecase.ll
new file mode 100644
index 000000000000..752de63c2933
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/SimplifyTerminatorOnSelect-domtree-preservation-edgecase.ll
@@ -0,0 +1,58 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=0 < %s | FileCheck %s
+
+declare void @widget()
+declare void @baz(i8)
+declare void @snork()
+declare void @spam(i8)
+declare void @zot()
+
+define void @wombat(i64 %arg, i1 %arg1) {
+; CHECK-LABEL: @wombat(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: [[COND:%.*]] = icmp eq i64 [[ARG:%.*]], 0
+; CHECK-NEXT: br i1 [[COND]], label [[BB4:%.*]], label [[BB2:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: call void @widget()
+; CHECK-NEXT: br label [[BB4]]
+; CHECK: bb4:
+; CHECK-NEXT: [[TMP:%.*]] = phi i8 [ 0, [[BB:%.*]] ], [ 1, [[BB2]] ]
+; CHECK-NEXT: call void @baz(i8 [[TMP]])
+; CHECK-NEXT: call void @snork()
+; CHECK-NEXT: call void @spam(i8 4)
+; CHECK-NEXT: ret void
+;
+bb:
+ switch i64 %arg, label %bb2 [
+ i64 0, label %bb3
+ ]
+
+bb2: ; preds = %bb
+ call void @widget()
+ br label %bb3
+
+bb3: ; preds = %bb2, %bb
+ %tmp = phi i8 [ 0, %bb ], [ 1, %bb2 ]
+ br label %bb4
+
+bb4: ; preds = %bb3
+ call void @baz(i8 %tmp)
+ %tmp5 = select i1 %arg1, i64 6, i64 3
+ switch i64 %tmp5, label %bb7 [
+ i64 1, label %bb6
+ i64 0, label %bb8
+ ]
+
+bb6: ; preds = %bb4
+ call void @zot()
+ br label %bb8
+
+bb7: ; preds = %bb4
+ call void @snork()
+ br label %bb8
+
+bb8: ; preds = %bb7, %bb6, %bb4
+ %tmp9 = phi i8 [ 2, %bb4 ], [ 3, %bb6 ], [ 4, %bb7 ]
+ call void @spam(i8 %tmp9)
+ ret void
+}
More information about the llvm-branch-commits
mailing list