[Tests] Add one more case to LoopUnroll/pr18861.ll for better coverage.
authorMichael Zolotukhin <mzolotukhin@apple.com>
Fri, 2 Oct 2015 19:21:52 +0000 (19:21 +0000)
committerMichael Zolotukhin <mzolotukhin@apple.com>
Fri, 2 Oct 2015 19:21:52 +0000 (19:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249174 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/LoopUnroll/pr18861.ll

index 225c483dd8a45246c88dd3c299a04f47189e6c5f..c01eef1d0e5de6e817ac598fa072529b1b188312 100644 (file)
@@ -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
+}