llvm/llvm/test/Transforms/NewGVN/2010-03-31-RedundantPHIs.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=newgvn -S | FileCheck %s

; CHECK-NOT: load
; CHECK-NOT: phi

define ptr @cat(ptr %s1, ...) nounwind {
; CHECK-LABEL: define ptr @cat(
; CHECK-SAME: ptr [[S1:%.*]], ...) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br i1 undef, label [[BB:%.*]], label [[BB3:%.*]]
; CHECK:       bb:
; CHECK-NEXT:    unreachable
; CHECK:       bb3:
; CHECK-NEXT:    store ptr undef, ptr undef, align 4
; CHECK-NEXT:    br i1 undef, label [[BB5:%.*]], label [[BB6:%.*]]
; CHECK:       bb5:
; CHECK-NEXT:    unreachable
; CHECK:       bb6:
; CHECK-NEXT:    br label [[BB12:%.*]]
; CHECK:       bb8:
; CHECK-NEXT:    br i1 undef, label [[BB9:%.*]], label [[BB10:%.*]]
; CHECK:       bb9:
; CHECK-NEXT:    br label [[BB11:%.*]]
; CHECK:       bb10:
; CHECK-NEXT:    br label [[BB11]]
; CHECK:       bb11:
; CHECK-NEXT:    br label [[BB12]]
; CHECK:       bb12:
; CHECK-NEXT:    br i1 undef, label [[BB8:%.*]], label [[BB13:%.*]]
; CHECK:       bb13:
; CHECK-NEXT:    ret ptr undef
;
entry:
  br i1 undef, label %bb, label %bb3

bb:                                               ; preds = %entry
  unreachable

bb3:                                              ; preds = %entry
  store ptr undef, ptr undef, align 4
  br i1 undef, label %bb5, label %bb6

bb5:                                              ; preds = %bb3
  unreachable

bb6:                                              ; preds = %bb3
  br label %bb12

bb8:                                              ; preds = %bb12
  br i1 undef, label %bb9, label %bb10

bb9:                                              ; preds = %bb8
  %0 = load ptr, ptr undef, align 4                   ; <ptr> [#uses=0]
  %1 = load ptr, ptr undef, align 4                   ; <ptr> [#uses=0]
  br label %bb11

bb10:                                             ; preds = %bb8
  br label %bb11

bb11:                                             ; preds = %bb10, %bb9
  br label %bb12

bb12:                                             ; preds = %bb11, %bb6
  br i1 undef, label %bb8, label %bb13

bb13:                                             ; preds = %bb12
  ret ptr undef
}