llvm-6502/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll
Stephen Lin 39f4e8d9cc Update Transforms tests to use CHECK-LABEL for easier debugging. No functionality change.
This update was done with the following bash script:

  find test/Transforms -name "*.ll" | \
  while read NAME; do
    echo "$NAME"
    if ! grep -q "^; *RUN: *llc" $NAME; then
      TEMP=`mktemp -t temp`
      cp $NAME $TEMP
      sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \
      while read FUNC; do
        sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP
      done
      mv $TEMP $NAME
    fi
  done


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186268 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-14 01:42:54 +00:00

82 lines
1.8 KiB
LLVM

; RUN: opt -loop-reduce -S < %s | FileCheck %s
;
; Test LSR's use of SplitCriticalEdge during phi rewriting.
target triple = "x86-apple-darwin"
; Verify that identical edges are merged. rdar://problem/6453893
; CHECK-LABEL: @test1(
; CHECK: bb89:
; CHECK: phi i8* [ %lsr.iv.next1, %bbA.bb89_crit_edge ], [ %lsr.iv.next1, %bbB.bb89_crit_edge ]{{$}}
define i8* @test1() {
entry:
br label %loop
loop:
%rec = phi i32 [ %next, %loop ], [ 0, %entry ]
%next = add i32 %rec, 1
%tmp75 = getelementptr i8* null, i32 %next
br i1 false, label %loop, label %loopexit
loopexit:
br i1 false, label %bbA, label %bbB
bbA:
switch i32 0, label %bb89 [
i32 47, label %bb89
i32 58, label %bb89
]
bbB:
switch i8 0, label %bb89 [
i8 47, label %bb89
i8 58, label %bb89
]
bb89:
%tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ]
br label %exit
exit:
ret i8* %tmp75phi
}
; Handle single-predecessor phis: PR13756
; CHECK-LABEL: @test2(
; CHECK: bb89:
; CHECK: phi i8* [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ], [ %lsr.iv.next1, %bbA ]{{$}}
define i8* @test2() {
entry:
br label %loop
loop:
%rec = phi i32 [ %next, %loop ], [ 0, %entry ]
%next = add i32 %rec, 1
%tmp75 = getelementptr i8* null, i32 %next
br i1 false, label %loop, label %loopexit
loopexit:
br i1 false, label %bbA, label %bbB
bbA:
switch i32 0, label %bb89 [
i32 47, label %bb89
i32 58, label %bb89
]
bbB:
switch i8 0, label %exit [
i8 47, label %exit
i8 58, label %exit
]
bb89:
%tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ]
br label %exit
exit:
%result = phi i8* [ %tmp75phi, %bb89 ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ]
ret i8* %result
}