[llvm] ea7ad8b - [NFC][SimplifyCFG] Add more fold-branch-to-common-dest tests

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 16:33:01 PST 2022


Author: Roman Lebedev
Date: 2022-12-07T03:32:42+03:00
New Revision: ea7ad8b3653efa49cc49899651ac3640c7b8a966

URL: https://github.com/llvm/llvm-project/commit/ea7ad8b3653efa49cc49899651ac3640c7b8a966
DIFF: https://github.com/llvm/llvm-project/commit/ea7ad8b3653efa49cc49899651ac3640c7b8a966.diff

LOG: [NFC][SimplifyCFG] Add more fold-branch-to-common-dest tests

Added: 
    

Modified: 
    llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest-phis.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest-phis.ll b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest-phis.ll
index cbeefa9932eed..31b7470283e87 100644
--- a/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest-phis.ll
+++ b/llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest-phis.ll
@@ -1,8 +1,10 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=1 | FileCheck %s --check-prefixes=ALL
+; RUN: opt < %s -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=1 | FileCheck %s --check-prefixes=ALL,CHEAP
+; RUN: opt < %s -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 | FileCheck %s --check-prefixes=ALL,COSTLY
 
 declare void @sideeffect0(i8)
 declare void @sideeffect1(i8)
+declare void @sideeffect1.vec(<2 x i8>)
 declare void @sideeffect2(i8)
 declare void @use1(i1)
 
@@ -412,3 +414,45 @@ final_right:
   call void @sideeffect1(i8 %final_right.phi.1)
   ret void
 }
+
+define void @incompatible_ivs_of_two_phis.vec(i8 %v0, i8 %v1, i8 %iv.of.final_left.from.dispatch, <2 x i8> %iv0.of.final_right.from.pred, <2 x i8> %iv0.of.final_right.from.dispatch, <2 x i8> %iv1.of.final_right.from.pred, <2 x i8> %iv1.of.final_right.from.dispatch) {
+; ALL-LABEL: @incompatible_ivs_of_two_phis.vec(
+; ALL-NEXT:  pred:
+; ALL-NEXT:    [[C0:%.*]] = icmp eq i8 [[V0:%.*]], 0
+; ALL-NEXT:    br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
+; ALL:       dispatch:
+; ALL-NEXT:    [[C1:%.*]] = icmp eq i8 [[V1:%.*]], 0
+; ALL-NEXT:    br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
+; ALL:       common.ret:
+; ALL-NEXT:    ret void
+; ALL:       final_left:
+; ALL-NEXT:    [[FINAL_LEFT_PHI:%.*]] = phi i8 [ [[IV_OF_FINAL_LEFT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
+; ALL-NEXT:    call void @sideeffect0(i8 [[FINAL_LEFT_PHI]])
+; ALL-NEXT:    br label [[COMMON_RET:%.*]]
+; ALL:       final_right:
+; ALL-NEXT:    [[FINAL_RIGHT_PHI_0:%.*]] = phi <2 x i8> [ [[IV0_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED:%.*]] ], [ [[IV0_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
+; ALL-NEXT:    [[FINAL_RIGHT_PHI_1:%.*]] = phi <2 x i8> [ [[IV1_OF_FINAL_RIGHT_FROM_PRED:%.*]], [[PRED]] ], [ [[IV1_OF_FINAL_RIGHT_FROM_DISPATCH:%.*]], [[DISPATCH]] ]
+; ALL-NEXT:    call void @sideeffect1.vec(<2 x i8> [[FINAL_RIGHT_PHI_0]])
+; ALL-NEXT:    call void @sideeffect1.vec(<2 x i8> [[FINAL_RIGHT_PHI_1]])
+; ALL-NEXT:    br label [[COMMON_RET]]
+;
+pred:
+  %c0 = icmp eq i8 %v0, 0
+  br i1 %c0, label %dispatch, label %final_right
+dispatch:
+  %c1 = icmp eq i8 %v1, 0
+  br i1 %c1, label %final_left, label %final_right
+final_left:
+  %final_left.phi = phi i8 [ %iv.of.final_left.from.dispatch, %dispatch ]
+  call void @sideeffect0(i8 %final_left.phi)
+  ret void
+final_right:
+  %final_right.phi.0 = phi <2 x i8> [ %iv0.of.final_right.from.pred, %pred ], [ %iv0.of.final_right.from.dispatch, %dispatch ]
+  %final_right.phi.1 = phi <2 x i8> [ %iv1.of.final_right.from.pred, %pred ], [ %iv1.of.final_right.from.dispatch, %dispatch ]
+  call void @sideeffect1.vec(<2 x i8> %final_right.phi.0)
+  call void @sideeffect1.vec(<2 x i8> %final_right.phi.1)
+  ret void
+}
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHEAP: {{.*}}
+; COSTLY: {{.*}}


        


More information about the llvm-commits mailing list