llvm/llvm/test/Transforms/SLPVectorizer/X86/phis-different-order.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -passes=slp-vectorizer -S < %s -mcpu=pentium4 -mtriple=i386-pc-windows-msvc19.16.0 | FileCheck %s

define ptr @test()  {
; CHECK-LABEL: define ptr @test
; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
; CHECK:       for.body:
; CHECK-NEXT:    [[PC:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ 0, [[BB:%.*]] ]
; CHECK-NEXT:    br i1 false, label [[FOR_INC:%.*]], label [[BB2:%.*]]
; CHECK:       for.inc:
; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <2 x i64> <i64 0, i64 poison>, i64 [[PC]], i32 1
; CHECK-NEXT:    br i1 false, label [[BB2]], label [[BB]]
; CHECK:       bb:
; CHECK-NEXT:    br i1 false, label [[BB2]], label [[FOR_BODY]]
; CHECK:       bb1:
; CHECK-NEXT:    br label [[BB2]]
; CHECK:       bb2:
; CHECK-NEXT:    [[TMP1:%.*]] = phi <2 x i64> [ poison, [[BB1:%.*]] ], [ [[TMP0]], [[BB]] ], [ [[TMP0]], [[FOR_INC]] ], [ zeroinitializer, [[FOR_BODY]] ]
; CHECK-NEXT:    store <2 x i64> [[TMP1]], ptr getelementptr inbounds ([7 x i64], ptr null, i32 0, i32 2), align 8
; CHECK-NEXT:    ret ptr null
;
entry:
  br label %for.body

for.body:
  %pc = phi i64 [ 0, %entry ], [ 0, %bb ]
  br i1 false, label %for.inc, label %bb2

for.inc:
  br i1 false, label %bb2, label %bb

bb:
  br i1 false, label %bb2, label %for.body

bb1:
  br label %bb2

bb2:
  %ph1 = phi i64 [ 0, %bb1 ], [ 0, %bb ], [ 0, %for.inc ], [ 0, %for.body ]
  %ph2 = phi i64 [ 0, %bb1 ], [ 0, %for.body ], [ %pc, %bb ], [ %pc, %for.inc ]
  store i64 %ph1, ptr getelementptr inbounds ([7 x i64], ptr null, i32 0, i32 2), align 8
  store i64 %ph2, ptr getelementptr inbounds ([7 x i64], ptr null, i32 0, i32 3), align 8
  ret ptr null
}