brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 3f247a2 Raw
88 lines · plain
1; RUN: opt < %s -passes=lcssa -S -o - | FileCheck %s2target triple = "x86_64-unknown-linux-gnu"3 4; PR284245; Here LCSSA adds phi-nodes for %x into the loop exits. Then, SSAUpdater needs6; to insert phi-nodes to merge these values. That creates a new def, which in7; its turn needs another LCCSA phi-node, and this test ensures that we insert8; it.9 10; CHECK-LABEL: @foo111define internal i32 @foo1(i1 %arg) {12entry:13  br label %header14 15header:16  %x = add i32 0, 117  br i1 %arg, label %if, label %loopexit118 19if:20  br i1 %arg, label %latch, label %loopexit221 22latch:23  br i1 %arg, label %header, label %loopexit324 25; CHECK: loopexit1:26; CHECK:   %x.lcssa = phi i32 [ %x, %header ]27loopexit1:28  br label %loop_with_insert_point29 30; CHECK: loopexit2:31; CHECK:   %x.lcssa1 = phi i32 [ %x, %if ]32loopexit2:33  br label %exit34 35; CHECK: loopexit3:36; CHECK:   %x.lcssa2 = phi i32 [ %x, %latch ]37loopexit3:38  br label %loop_with_insert_point39 40; CHECK: loop_with_insert_point:41; CHECK:   %x4 = phi i32 [ %x4, %loop_with_insert_point ], [ %x.lcssa2, %loopexit3 ], [ %x.lcssa, %loopexit1 ]42loop_with_insert_point:43  br i1 %arg, label %loop_with_insert_point, label %bb44 45; CHECK: bb:46; CHECK:   %x4.lcssa = phi i32 [ %x4, %loop_with_insert_point ]47bb:48  br label %exit49 50; CHECK: exit:51; CHECK:   %x3 = phi i32 [ %x4.lcssa, %bb ], [ %x.lcssa1, %loopexit2 ]52exit:53  ret i32 %x54}55 56; CHECK-LABEL: @foo257define internal i32 @foo2(i1 %arg) {58entry:59  br label %header60 61header:62  %x = add i32 0, 163  br i1 %arg, label %latch, label %loopexit164 65latch:66  br i1 %arg, label %header, label %loopexit267 68; CHECK: loopexit1:69; CHECK:   %x.lcssa = phi i32 [ %x, %header ]70loopexit1:71  br label %loop_with_insert_point72 73; CHECK: loopexit2:74; CHECK:   %x.lcssa1 = phi i32 [ %x, %latch ]75loopexit2:76  br label %loop_with_insert_point77 78; CHECK: loop_with_insert_point:79; CHECK:   %x2 = phi i32 [ %x2, %loop_with_insert_point ], [ %x.lcssa1, %loopexit2 ], [ %x.lcssa, %loopexit1 ]80loop_with_insert_point:81  br i1 %arg, label %loop_with_insert_point, label %exit82 83; CHECK: exit:84; CHECK:   %x2.lcssa = phi i32 [ %x2, %loop_with_insert_point ]85exit:86  ret i32 %x87}88