[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / test / Transforms / LoopSimplifyCFG / irreducible_cfg.ll
blobe7c8afc389d23a71f1e1a299359754d7a74358b8
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; REQUIRES: asserts
3 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -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='require<domtree>,loop(simplify-cfg)' -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
5 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -loop-simplifycfg -enable-mssa-loop-dependency=true -verify-memoryssa -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
9 ; This test has irreducible CFG, and RPO may be the following:
10 ; Header, Dead, Irreducible2, Latch, Irreducible3, Irreducible1.
11 ; As result, we will process Irreducible2 before its predecessor Irreducible1.
12 ; The current algorithm gets confused in this case. We may support irreducible
13 ; CFG in the future.
14 define void @irreducible_cfg(i1 %cond) {
15 ; CHECK-LABEL: @irreducible_cfg(
16 ; CHECK-NEXT:  entry:
17 ; CHECK-NEXT:    br label [[HEADER:%.*]]
18 ; CHECK:       header:
19 ; CHECK-NEXT:    br i1 false, label [[DEAD:%.*]], label [[IRREDUCIBLE1:%.*]]
20 ; CHECK:       dead:
21 ; CHECK-NEXT:    br label [[IRREDUCIBLE2:%.*]]
22 ; CHECK:       irreducible2:
23 ; CHECK-NEXT:    br i1 [[COND:%.*]], label [[LATCH:%.*]], label [[IRREDUCIBLE3:%.*]]
24 ; CHECK:       latch:
25 ; CHECK-NEXT:    br label [[HEADER]]
26 ; CHECK:       irreducible3:
27 ; CHECK-NEXT:    br label [[IRREDUCIBLE1]]
28 ; CHECK:       irreducible1:
29 ; CHECK-NEXT:    br label [[IRREDUCIBLE2]]
31 entry:
32   br label %header
34 header:                                             ; preds = %latch, %entry
35   br i1 false, label %dead, label %irreducible1
37 dead:                                          ; preds = %header
38   br label %irreducible2
40 irreducible2:                                             ; preds = %irreducible1, %dead
41   br i1 %cond, label %latch, label %irreducible3
43 latch:                                         ; preds = %irreducible2
44   br label %header
46 irreducible3:                                           ; preds = %irreducible2
47   br label %irreducible1
49 irreducible1:                                          ; preds = %irreducible3, %header
50   br label %irreducible2