1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
3 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes='require<domtree>,loop(loop-simplifycfg)' -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
4 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes=loop-simplifycfg -verify-memoryssa -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
8 ; This test has irreducible CFG, and RPO may be the following:
9 ; Header, Dead, Irreducible2, Latch, Irreducible3, Irreducible1.
10 ; As result, we will process Irreducible2 before its predecessor Irreducible1.
11 ; The current algorithm gets confused in this case. We may support irreducible
13 define void @irreducible_cfg(i1 %cond) {
14 ; CHECK-LABEL: @irreducible_cfg(
16 ; CHECK-NEXT: br label [[HEADER:%.*]]
18 ; CHECK-NEXT: br i1 false, label [[DEAD:%.*]], label [[IRREDUCIBLE1:%.*]]
20 ; CHECK-NEXT: br label [[IRREDUCIBLE2:%.*]]
21 ; CHECK: irreducible2:
22 ; CHECK-NEXT: br i1 [[COND:%.*]], label [[LATCH:%.*]], label [[IRREDUCIBLE3:%.*]]
24 ; CHECK-NEXT: br label [[HEADER]]
25 ; CHECK: irreducible3:
26 ; CHECK-NEXT: br label [[IRREDUCIBLE1]]
27 ; CHECK: irreducible1:
28 ; CHECK-NEXT: br label [[IRREDUCIBLE2]]
33 header: ; preds = %latch, %entry
34 br i1 false, label %dead, label %irreducible1
36 dead: ; preds = %header
37 br label %irreducible2
39 irreducible2: ; preds = %irreducible1, %dead
40 br i1 %cond, label %latch, label %irreducible3
42 latch: ; preds = %irreducible2
45 irreducible3: ; preds = %irreducible2
46 br label %irreducible1
48 irreducible1: ; preds = %irreducible3, %header
49 br label %irreducible2