xref: /aosp_15_r20/external/llvm/test/Transforms/LICM/2014-09-10-doFinalizationAssert.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -scalar-evolution -licm -loop-unroll -disable-output
2*9880d681SAndroid Build Coastguard Worker; Test triggered an assertion in doFinalization() because loop unroll was deleting
3*9880d681SAndroid Build Coastguard Worker; the inner loop which caused the loop to not get removed from the
4*9880d681SAndroid Build Coastguard Worker; LoopToAliasSetMap.
5*9880d681SAndroid Build Coastguard Worker; Test case taken from test/Transforms/LoopUnroll/unloop.ll.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdeclare i1 @check() nounwind
8*9880d681SAndroid Build Coastguard Workerdefine void @skiplevelexit() nounwind {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker  br label %outer
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerouter:
13*9880d681SAndroid Build Coastguard Worker  br label %inner
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerinner:
16*9880d681SAndroid Build Coastguard Worker  %iv = phi i32 [ 0, %outer ], [ %inc, %tail ]
17*9880d681SAndroid Build Coastguard Worker  %inc = add i32 %iv, 1
18*9880d681SAndroid Build Coastguard Worker  call zeroext i1 @check()
19*9880d681SAndroid Build Coastguard Worker  br i1 true, label %outer.backedge, label %tail
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workertail:
22*9880d681SAndroid Build Coastguard Worker  br i1 false, label %inner, label %exit
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerouter.backedge:
25*9880d681SAndroid Build Coastguard Worker  br label %outer
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerexit:
28*9880d681SAndroid Build Coastguard Worker  ret void
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31