1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3 2; RUN: opt -passes=slp-vectorizer -mtriple=x86_64 -mattr=+avx2 -S < %s | FileCheck %s 3 4; Test case for issue #69670. 5 6; #69392 uncovered a problem with delayed gather nodes emission, specifically 7; when the node is a PHI operand, which depends on another gathered node, 8; also an operand of a PHI (in another block). 9 10define void @test() { 11; CHECK-LABEL: define void @test( 12; CHECK-SAME: ) #[[ATTR0:[0-9]+]] { 13; CHECK-NEXT: entry: 14; CHECK-NEXT: [[DOTPRE_PRE:%.*]] = load float, ptr poison, align 4 15; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x float> <float poison, float undef>, float [[DOTPRE_PRE]], i32 0 16; CHECK-NEXT: br label [[BB1:%.*]] 17; CHECK: bb1: 18; CHECK-NEXT: [[TMP1:%.*]] = phi <2 x float> [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP10:%.*]], [[BB2:%.*]] ] 19; CHECK-NEXT: br label [[BB2]] 20; CHECK: bb2: 21; CHECK-NEXT: [[TMP2:%.*]] = phi <2 x float> [ [[TMP1]], [[BB1]] ], [ [[TMP9:%.*]], [[BB2]] ] 22; CHECK-NEXT: [[I1:%.*]] = load float, ptr poison, align 4 23; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x float> [[TMP2]], <2 x float> poison, <2 x i32> <i32 1, i32 poison> 24; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x float> [[TMP3]], float [[I1]], i32 1 25; CHECK-NEXT: [[TMP5:%.*]] = fdiv <2 x float> [[TMP2]], [[TMP4]] 26; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x float> [[TMP5]], i32 0 27; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x float> [[TMP5]], i32 1 28; CHECK-NEXT: [[MUL:%.*]] = fmul float [[TMP6]], [[TMP7]] 29; CHECK-NEXT: tail call void @foo(float [[MUL]]) 30; CHECK-NEXT: [[I2:%.*]] = load float, ptr poison, align 4 31; CHECK-NEXT: [[TOBOOL:%.*]] = fcmp une float [[I2]], 0.000000e+00 32; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <2 x float> [[TMP5]], <2 x float> poison, <2 x i32> <i32 poison, i32 0> 33; CHECK-NEXT: [[TMP9]] = insertelement <2 x float> [[TMP8]], float [[I2]], i32 0 34; CHECK-NEXT: [[TMP10]] = shufflevector <2 x float> [[TMP9]], <2 x float> [[TMP2]], <2 x i32> <i32 0, i32 3> 35; CHECK-NEXT: br i1 [[TOBOOL]], label [[BB1]], label [[BB2]] 36; 37entry: 38 %.pre.pre = load float, ptr poison, align 4 39 br label %bb1 40 41bb1: ; preds = %bb2, %entry 42 %.pre = phi float [ %.pre.pre, %entry ], [ %i2, %bb2 ] 43 %foxtrot.0 = phi float [ undef, %entry ], [ %gulf.0, %bb2 ] 44 br label %bb2 45 46bb2: ; preds = %bb2, %bb1 47 %i = phi float [ %.pre, %bb1 ], [ %i2, %bb2 ] 48 %gulf.0 = phi float [ %foxtrot.0, %bb1 ], [ %div, %bb2 ] 49 %div = fdiv float %i, %gulf.0 50 %i1 = load float, ptr poison, align 4 51 %div1 = fdiv float %gulf.0, %i1 52 %mul = fmul float %div, %div1 53 tail call void @foo(float %mul) 54 %i2 = load float, ptr poison, align 4 55 %tobool = fcmp une float %i2, 0.000000e+00 56 br i1 %tobool, label %bb1, label %bb2 57} 58 59declare void @foo(float) 60