From c04323ec72fc663d8b4c42aa9be237ac9a8562ac Mon Sep 17 00:00:00 2001 From: Michael Zolotukhin Date: Fri, 2 Oct 2015 19:21:52 +0000 Subject: [PATCH] [Tests] Add one more case to LoopUnroll/pr18861.ll for better coverage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249174 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/LoopUnroll/pr18861.ll | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/Transforms/LoopUnroll/pr18861.ll b/test/Transforms/LoopUnroll/pr18861.ll index 225c483dd8a..c01eef1d0e5 100644 --- a/test/Transforms/LoopUnroll/pr18861.ll +++ b/test/Transforms/LoopUnroll/pr18861.ll @@ -53,3 +53,34 @@ outer.latch: ; preds = %inner.header %inc9 = add nsw i32 %storemerge1, 1 br label %outer.header } + +; This case is similar to the previous one, and has the same CFG. +; The difference is that loop unrolling doesn't remove any LCSSA definition, +; yet breaks LCSSA form for the outer loop. It happens because before unrolling +; block inner.latch was inside outer loop (and consequently, didn't require +; LCSSA definition for %x), but after unrolling it occurs out of the outer +; loop, so we need to insert an LCSSA definition to keep LCSSA. + +; Function Attrs: nounwind uwtable +define void @fn2() { +entry: + br label %outer.header + +outer.header: + br label %inner.header + +inner.header: + %x = load i32, i32* undef, align 4 + br i1 true, label %outer.latch, label %inner.latch + +inner.latch: + %inc6 = add nsw i32 %x, 1 + store i32 %inc6, i32* undef, align 4 + br i1 false, label %inner.header, label %exit + +exit: + ret void + +outer.latch: + br label %outer.header +} -- 2.34.1