llvm.org GIT mirror llvm / 0f98731
Revert "Revert "[LoopSimplify] Fix updating LCSSA after separating nested loops."" This reverts commit r277901. Reaaply the commit as it looks like it has nothing to do with the bots failures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277946 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Zolotukhin 3 years ago
2 changed file(s) with 48 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
375375 }
376376 }
377377 }
378 // We also need to check exit blocks of the outer loop - it might be using
379 // values from what now became an inner loop.
380 SmallVector ExitBlocks;
381 NewOuter->getExitBlocks(ExitBlocks);
382 for (BasicBlock *ExitBB: ExitBlocks) {
383 for (Instruction &I : *ExitBB) {
384 for (Value *Op : I.operands()) {
385 Instruction *OpI = dyn_cast(Op);
386 if (!OpI || !L->contains(OpI))
387 continue;
388 WorklistSet.insert(OpI);
389 }
390 }
391 }
392
378393 SmallVector Worklist(WorklistSet.begin(),
379394 WorklistSet.end());
380395 formLCSSAForInstructions(Worklist, *DT, *LI);
0 ; RUN: opt < %s -lcssa -loop-unroll -S | FileCheck %s
11 target triple = "x86_64-unknown-linux-gnu"
22
3 ; PR28272
3 ; PR28272, PR28825
44 ; When LoopSimplify separates nested loops, it might break LCSSA form: values
55 ; from the original loop might be used in the outer loop. This test invokes
66 ; loop-unroll, which calls loop-simplify before itself. If LCSSA is broken
7373 bb:
7474 br label %loop2
7575 }
76
77 ; When LoopSimplify separates nested loops, it might break LCSSA form: values
78 ; from the original loop might be used in exit blocks of the outer loop.
79 ; CHECK-LABEL: @foo3
80 define void @foo3() {
81 entry:
82 br label %bb1
83
84 bb1:
85 br i1 undef, label %bb2, label %bb1
86
87 bb2:
88 %a = phi i32 [ undef, %bb1 ], [ %a, %bb3 ], [ undef, %bb5 ]
89 br i1 undef, label %bb3, label %bb1
90
91 bb3:
92 %b = load i32*, i32** undef
93 br i1 undef, label %bb2, label %bb4
94
95 bb4:
96 br i1 undef, label %bb5, label %bb6
97
98 bb5:
99 br i1 undef, label %bb2, label %bb4
100
101 bb6:
102 br i1 undef, label %bb_end, label %bb1
103
104 bb_end:
105 %x = getelementptr i32, i32* %b
106 br label %bb_end
107 }