Files
clang-p2996/llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-break-large-phis.ll
pvanhout b3b3cb2d2f [AMDGPU] Less aggressively break large PHIs
In some cases, breaking large PHIs can very negatively affect
performance (3x more instructions observed in a particular test case).

This patch adds some basic profitability heuristics to help with some of these issues without affecting the "good" cases.
e.g. avoid breaking PHIs if it causes back-and-forth between vector/scalar form for no good reason.

Fixes SWDEV-392803
Fixes SWDEV-393781
Fixes SWDEV-394228

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D147786
2023-04-14 15:41:26 +02:00

1061 lines
63 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=amdgcn-- -amdgpu-codegenprepare -amdgpu-codegenprepare-force-break-large-phis %s | FileCheck %s --check-prefixes=OPT
; RUN: opt -S -mtriple=amdgcn-- -amdgpu-codegenprepare --global-isel %s | FileCheck %s --check-prefixes=NOOPT
; RUN: opt -S -mtriple=amdgcn-- -amdgpu-codegenprepare -amdgpu-codegenprepare-break-large-phis=0 %s | FileCheck %s --check-prefixes=NOOPT
define amdgpu_kernel void @phi_v5f64(<5 x double> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v5f64(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <5 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; OPT-NEXT: [[TMP0:%.*]] = extractelement <5 x double> [[X]], i64 0
; OPT-NEXT: [[TMP1:%.*]] = extractelement <5 x double> [[X]], i64 1
; OPT-NEXT: [[TMP2:%.*]] = extractelement <5 x double> [[X]], i64 2
; OPT-NEXT: [[TMP3:%.*]] = extractelement <5 x double> [[X]], i64 3
; OPT-NEXT: [[TMP4:%.*]] = extractelement <5 x double> [[X]], i64 4
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <5 x double> [[IN]], double 9.140000e+00, i32 2
; OPT-NEXT: [[TMP5:%.*]] = extractelement <5 x double> [[Y]], i64 0
; OPT-NEXT: [[TMP6:%.*]] = extractelement <5 x double> [[Y]], i64 1
; OPT-NEXT: [[TMP7:%.*]] = extractelement <5 x double> [[Y]], i64 2
; OPT-NEXT: [[TMP8:%.*]] = extractelement <5 x double> [[Y]], i64 3
; OPT-NEXT: [[TMP9:%.*]] = extractelement <5 x double> [[Y]], i64 4
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP10:%.*]] = phi double [ [[TMP0]], [[THEN]] ], [ [[TMP5]], [[ELSE]] ]
; OPT-NEXT: [[TMP11:%.*]] = phi double [ [[TMP1]], [[THEN]] ], [ [[TMP6]], [[ELSE]] ]
; OPT-NEXT: [[TMP12:%.*]] = phi double [ [[TMP2]], [[THEN]] ], [ [[TMP7]], [[ELSE]] ]
; OPT-NEXT: [[TMP13:%.*]] = phi double [ [[TMP3]], [[THEN]] ], [ [[TMP8]], [[ELSE]] ]
; OPT-NEXT: [[TMP14:%.*]] = phi double [ [[TMP4]], [[THEN]] ], [ [[TMP9]], [[ELSE]] ]
; OPT-NEXT: [[TMP15:%.*]] = insertelement <5 x double> poison, double [[TMP10]], i64 0
; OPT-NEXT: [[TMP16:%.*]] = insertelement <5 x double> [[TMP15]], double [[TMP11]], i64 1
; OPT-NEXT: [[TMP17:%.*]] = insertelement <5 x double> [[TMP16]], double [[TMP12]], i64 2
; OPT-NEXT: [[TMP18:%.*]] = insertelement <5 x double> [[TMP17]], double [[TMP13]], i64 3
; OPT-NEXT: [[TMP19:%.*]] = insertelement <5 x double> [[TMP18]], double [[TMP14]], i64 4
; OPT-NEXT: store <5 x double> [[TMP19]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v5f64(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <5 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <5 x double> [[IN]], double 9.140000e+00, i32 2
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <5 x double> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <5 x double> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <5 x double> %in, double 3.14, i32 3
br label %finally
else:
%y = insertelement <5 x double> %in, double 9.14, i32 2
br label %finally
finally:
%val = phi <5 x double> [%x, %then], [%y, %else]
store <5 x double> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v7f64(<7 x double> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v7f64(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <7 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; OPT-NEXT: [[TMP0:%.*]] = extractelement <7 x double> [[X]], i64 0
; OPT-NEXT: [[TMP1:%.*]] = extractelement <7 x double> [[X]], i64 1
; OPT-NEXT: [[TMP2:%.*]] = extractelement <7 x double> [[X]], i64 2
; OPT-NEXT: [[TMP3:%.*]] = extractelement <7 x double> [[X]], i64 3
; OPT-NEXT: [[TMP4:%.*]] = extractelement <7 x double> [[X]], i64 4
; OPT-NEXT: [[TMP5:%.*]] = extractelement <7 x double> [[X]], i64 5
; OPT-NEXT: [[TMP6:%.*]] = extractelement <7 x double> [[X]], i64 6
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <7 x double> [[IN]], double 9.140000e+00, i32 6
; OPT-NEXT: [[TMP7:%.*]] = extractelement <7 x double> [[Y]], i64 0
; OPT-NEXT: [[TMP8:%.*]] = extractelement <7 x double> [[Y]], i64 1
; OPT-NEXT: [[TMP9:%.*]] = extractelement <7 x double> [[Y]], i64 2
; OPT-NEXT: [[TMP10:%.*]] = extractelement <7 x double> [[Y]], i64 3
; OPT-NEXT: [[TMP11:%.*]] = extractelement <7 x double> [[Y]], i64 4
; OPT-NEXT: [[TMP12:%.*]] = extractelement <7 x double> [[Y]], i64 5
; OPT-NEXT: [[TMP13:%.*]] = extractelement <7 x double> [[Y]], i64 6
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP14:%.*]] = phi double [ [[TMP0]], [[THEN]] ], [ [[TMP7]], [[ELSE]] ]
; OPT-NEXT: [[TMP15:%.*]] = phi double [ [[TMP1]], [[THEN]] ], [ [[TMP8]], [[ELSE]] ]
; OPT-NEXT: [[TMP16:%.*]] = phi double [ [[TMP2]], [[THEN]] ], [ [[TMP9]], [[ELSE]] ]
; OPT-NEXT: [[TMP17:%.*]] = phi double [ [[TMP3]], [[THEN]] ], [ [[TMP10]], [[ELSE]] ]
; OPT-NEXT: [[TMP18:%.*]] = phi double [ [[TMP4]], [[THEN]] ], [ [[TMP11]], [[ELSE]] ]
; OPT-NEXT: [[TMP19:%.*]] = phi double [ [[TMP5]], [[THEN]] ], [ [[TMP12]], [[ELSE]] ]
; OPT-NEXT: [[TMP20:%.*]] = phi double [ [[TMP6]], [[THEN]] ], [ [[TMP13]], [[ELSE]] ]
; OPT-NEXT: [[TMP21:%.*]] = insertelement <7 x double> poison, double [[TMP14]], i64 0
; OPT-NEXT: [[TMP22:%.*]] = insertelement <7 x double> [[TMP21]], double [[TMP15]], i64 1
; OPT-NEXT: [[TMP23:%.*]] = insertelement <7 x double> [[TMP22]], double [[TMP16]], i64 2
; OPT-NEXT: [[TMP24:%.*]] = insertelement <7 x double> [[TMP23]], double [[TMP17]], i64 3
; OPT-NEXT: [[TMP25:%.*]] = insertelement <7 x double> [[TMP24]], double [[TMP18]], i64 4
; OPT-NEXT: [[TMP26:%.*]] = insertelement <7 x double> [[TMP25]], double [[TMP19]], i64 5
; OPT-NEXT: [[TMP27:%.*]] = insertelement <7 x double> [[TMP26]], double [[TMP20]], i64 6
; OPT-NEXT: store <7 x double> [[TMP27]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v7f64(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <7 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <7 x double> [[IN]], double 9.140000e+00, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <7 x double> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <7 x double> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <7 x double> %in, double 3.14, i32 3
br label %finally
else:
%y = insertelement <7 x double> %in, double 9.14, i32 6
br label %finally
finally:
%val = phi <7 x double> [%x, %then], [%y, %else]
store <7 x double> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v11f64(<11 x double> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v11f64(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <11 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; OPT-NEXT: [[TMP0:%.*]] = extractelement <11 x double> [[X]], i64 0
; OPT-NEXT: [[TMP1:%.*]] = extractelement <11 x double> [[X]], i64 1
; OPT-NEXT: [[TMP2:%.*]] = extractelement <11 x double> [[X]], i64 2
; OPT-NEXT: [[TMP3:%.*]] = extractelement <11 x double> [[X]], i64 3
; OPT-NEXT: [[TMP4:%.*]] = extractelement <11 x double> [[X]], i64 4
; OPT-NEXT: [[TMP5:%.*]] = extractelement <11 x double> [[X]], i64 5
; OPT-NEXT: [[TMP6:%.*]] = extractelement <11 x double> [[X]], i64 6
; OPT-NEXT: [[TMP7:%.*]] = extractelement <11 x double> [[X]], i64 7
; OPT-NEXT: [[TMP8:%.*]] = extractelement <11 x double> [[X]], i64 8
; OPT-NEXT: [[TMP9:%.*]] = extractelement <11 x double> [[X]], i64 9
; OPT-NEXT: [[TMP10:%.*]] = extractelement <11 x double> [[X]], i64 10
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <11 x double> [[IN]], double 9.140000e+00, i32 6
; OPT-NEXT: [[TMP11:%.*]] = extractelement <11 x double> [[Y]], i64 0
; OPT-NEXT: [[TMP12:%.*]] = extractelement <11 x double> [[Y]], i64 1
; OPT-NEXT: [[TMP13:%.*]] = extractelement <11 x double> [[Y]], i64 2
; OPT-NEXT: [[TMP14:%.*]] = extractelement <11 x double> [[Y]], i64 3
; OPT-NEXT: [[TMP15:%.*]] = extractelement <11 x double> [[Y]], i64 4
; OPT-NEXT: [[TMP16:%.*]] = extractelement <11 x double> [[Y]], i64 5
; OPT-NEXT: [[TMP17:%.*]] = extractelement <11 x double> [[Y]], i64 6
; OPT-NEXT: [[TMP18:%.*]] = extractelement <11 x double> [[Y]], i64 7
; OPT-NEXT: [[TMP19:%.*]] = extractelement <11 x double> [[Y]], i64 8
; OPT-NEXT: [[TMP20:%.*]] = extractelement <11 x double> [[Y]], i64 9
; OPT-NEXT: [[TMP21:%.*]] = extractelement <11 x double> [[Y]], i64 10
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP22:%.*]] = phi double [ [[TMP0]], [[THEN]] ], [ [[TMP11]], [[ELSE]] ]
; OPT-NEXT: [[TMP23:%.*]] = phi double [ [[TMP1]], [[THEN]] ], [ [[TMP12]], [[ELSE]] ]
; OPT-NEXT: [[TMP24:%.*]] = phi double [ [[TMP2]], [[THEN]] ], [ [[TMP13]], [[ELSE]] ]
; OPT-NEXT: [[TMP25:%.*]] = phi double [ [[TMP3]], [[THEN]] ], [ [[TMP14]], [[ELSE]] ]
; OPT-NEXT: [[TMP26:%.*]] = phi double [ [[TMP4]], [[THEN]] ], [ [[TMP15]], [[ELSE]] ]
; OPT-NEXT: [[TMP27:%.*]] = phi double [ [[TMP5]], [[THEN]] ], [ [[TMP16]], [[ELSE]] ]
; OPT-NEXT: [[TMP28:%.*]] = phi double [ [[TMP6]], [[THEN]] ], [ [[TMP17]], [[ELSE]] ]
; OPT-NEXT: [[TMP29:%.*]] = phi double [ [[TMP7]], [[THEN]] ], [ [[TMP18]], [[ELSE]] ]
; OPT-NEXT: [[TMP30:%.*]] = phi double [ [[TMP8]], [[THEN]] ], [ [[TMP19]], [[ELSE]] ]
; OPT-NEXT: [[TMP31:%.*]] = phi double [ [[TMP9]], [[THEN]] ], [ [[TMP20]], [[ELSE]] ]
; OPT-NEXT: [[TMP32:%.*]] = phi double [ [[TMP10]], [[THEN]] ], [ [[TMP21]], [[ELSE]] ]
; OPT-NEXT: [[TMP33:%.*]] = insertelement <11 x double> poison, double [[TMP22]], i64 0
; OPT-NEXT: [[TMP34:%.*]] = insertelement <11 x double> [[TMP33]], double [[TMP23]], i64 1
; OPT-NEXT: [[TMP35:%.*]] = insertelement <11 x double> [[TMP34]], double [[TMP24]], i64 2
; OPT-NEXT: [[TMP36:%.*]] = insertelement <11 x double> [[TMP35]], double [[TMP25]], i64 3
; OPT-NEXT: [[TMP37:%.*]] = insertelement <11 x double> [[TMP36]], double [[TMP26]], i64 4
; OPT-NEXT: [[TMP38:%.*]] = insertelement <11 x double> [[TMP37]], double [[TMP27]], i64 5
; OPT-NEXT: [[TMP39:%.*]] = insertelement <11 x double> [[TMP38]], double [[TMP28]], i64 6
; OPT-NEXT: [[TMP40:%.*]] = insertelement <11 x double> [[TMP39]], double [[TMP29]], i64 7
; OPT-NEXT: [[TMP41:%.*]] = insertelement <11 x double> [[TMP40]], double [[TMP30]], i64 8
; OPT-NEXT: [[TMP42:%.*]] = insertelement <11 x double> [[TMP41]], double [[TMP31]], i64 9
; OPT-NEXT: [[TMP43:%.*]] = insertelement <11 x double> [[TMP42]], double [[TMP32]], i64 10
; OPT-NEXT: store <11 x double> [[TMP43]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v11f64(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <11 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <11 x double> [[IN]], double 9.140000e+00, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <11 x double> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <11 x double> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <11 x double> %in, double 3.14, i32 3
br label %finally
else:
%y = insertelement <11 x double> %in, double 9.14, i32 6
br label %finally
finally:
%val = phi <11 x double> [%x, %then], [%y, %else]
store <11 x double> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v11f64_cst(<11 x double> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v11f64_cst(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[FINALLY:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <11 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; OPT-NEXT: [[TMP0:%.*]] = extractelement <11 x double> [[X]], i64 0
; OPT-NEXT: [[TMP1:%.*]] = extractelement <11 x double> [[X]], i64 1
; OPT-NEXT: [[TMP2:%.*]] = extractelement <11 x double> [[X]], i64 2
; OPT-NEXT: [[TMP3:%.*]] = extractelement <11 x double> [[X]], i64 3
; OPT-NEXT: [[TMP4:%.*]] = extractelement <11 x double> [[X]], i64 4
; OPT-NEXT: [[TMP5:%.*]] = extractelement <11 x double> [[X]], i64 5
; OPT-NEXT: [[TMP6:%.*]] = extractelement <11 x double> [[X]], i64 6
; OPT-NEXT: [[TMP7:%.*]] = extractelement <11 x double> [[X]], i64 7
; OPT-NEXT: [[TMP8:%.*]] = extractelement <11 x double> [[X]], i64 8
; OPT-NEXT: [[TMP9:%.*]] = extractelement <11 x double> [[X]], i64 9
; OPT-NEXT: [[TMP10:%.*]] = extractelement <11 x double> [[X]], i64 10
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP11:%.*]] = phi double [ [[TMP0]], [[THEN]] ], [ 0.000000e+00, [[ENTRY:%.*]] ]
; OPT-NEXT: [[TMP12:%.*]] = phi double [ [[TMP1]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP13:%.*]] = phi double [ [[TMP2]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP14:%.*]] = phi double [ [[TMP3]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP15:%.*]] = phi double [ [[TMP4]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP16:%.*]] = phi double [ [[TMP5]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP17:%.*]] = phi double [ [[TMP6]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP18:%.*]] = phi double [ [[TMP7]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP19:%.*]] = phi double [ [[TMP8]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP20:%.*]] = phi double [ [[TMP9]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP21:%.*]] = phi double [ [[TMP10]], [[THEN]] ], [ 0.000000e+00, [[ENTRY]] ]
; OPT-NEXT: [[TMP22:%.*]] = insertelement <11 x double> poison, double [[TMP11]], i64 0
; OPT-NEXT: [[TMP23:%.*]] = insertelement <11 x double> [[TMP22]], double [[TMP12]], i64 1
; OPT-NEXT: [[TMP24:%.*]] = insertelement <11 x double> [[TMP23]], double [[TMP13]], i64 2
; OPT-NEXT: [[TMP25:%.*]] = insertelement <11 x double> [[TMP24]], double [[TMP14]], i64 3
; OPT-NEXT: [[TMP26:%.*]] = insertelement <11 x double> [[TMP25]], double [[TMP15]], i64 4
; OPT-NEXT: [[TMP27:%.*]] = insertelement <11 x double> [[TMP26]], double [[TMP16]], i64 5
; OPT-NEXT: [[TMP28:%.*]] = insertelement <11 x double> [[TMP27]], double [[TMP17]], i64 6
; OPT-NEXT: [[TMP29:%.*]] = insertelement <11 x double> [[TMP28]], double [[TMP18]], i64 7
; OPT-NEXT: [[TMP30:%.*]] = insertelement <11 x double> [[TMP29]], double [[TMP19]], i64 8
; OPT-NEXT: [[TMP31:%.*]] = insertelement <11 x double> [[TMP30]], double [[TMP20]], i64 9
; OPT-NEXT: [[TMP32:%.*]] = insertelement <11 x double> [[TMP31]], double [[TMP21]], i64 10
; OPT-NEXT: store <11 x double> [[TMP32]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v11f64_cst(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[FINALLY:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <11 x double> [[IN:%.*]], double 3.140000e+00, i32 3
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <11 x double> [ [[X]], [[THEN]] ], [ zeroinitializer, [[ENTRY:%.*]] ]
; NOOPT-NEXT: store <11 x double> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %finally
then:
%x = insertelement <11 x double> %in, double 3.14, i32 3
br label %finally
finally:
%val = phi <11 x double> [%x, %then], [zeroinitializer, %entry]
store <11 x double> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v15i64(<15 x i64> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v15i64(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <15 x i64> [[IN:%.*]], i64 42, i32 3
; OPT-NEXT: [[TMP0:%.*]] = extractelement <15 x i64> [[X]], i64 0
; OPT-NEXT: [[TMP1:%.*]] = extractelement <15 x i64> [[X]], i64 1
; OPT-NEXT: [[TMP2:%.*]] = extractelement <15 x i64> [[X]], i64 2
; OPT-NEXT: [[TMP3:%.*]] = extractelement <15 x i64> [[X]], i64 3
; OPT-NEXT: [[TMP4:%.*]] = extractelement <15 x i64> [[X]], i64 4
; OPT-NEXT: [[TMP5:%.*]] = extractelement <15 x i64> [[X]], i64 5
; OPT-NEXT: [[TMP6:%.*]] = extractelement <15 x i64> [[X]], i64 6
; OPT-NEXT: [[TMP7:%.*]] = extractelement <15 x i64> [[X]], i64 7
; OPT-NEXT: [[TMP8:%.*]] = extractelement <15 x i64> [[X]], i64 8
; OPT-NEXT: [[TMP9:%.*]] = extractelement <15 x i64> [[X]], i64 9
; OPT-NEXT: [[TMP10:%.*]] = extractelement <15 x i64> [[X]], i64 10
; OPT-NEXT: [[TMP11:%.*]] = extractelement <15 x i64> [[X]], i64 11
; OPT-NEXT: [[TMP12:%.*]] = extractelement <15 x i64> [[X]], i64 12
; OPT-NEXT: [[TMP13:%.*]] = extractelement <15 x i64> [[X]], i64 13
; OPT-NEXT: [[TMP14:%.*]] = extractelement <15 x i64> [[X]], i64 14
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <15 x i64> [[IN]], i64 64, i32 6
; OPT-NEXT: [[TMP15:%.*]] = extractelement <15 x i64> [[Y]], i64 0
; OPT-NEXT: [[TMP16:%.*]] = extractelement <15 x i64> [[Y]], i64 1
; OPT-NEXT: [[TMP17:%.*]] = extractelement <15 x i64> [[Y]], i64 2
; OPT-NEXT: [[TMP18:%.*]] = extractelement <15 x i64> [[Y]], i64 3
; OPT-NEXT: [[TMP19:%.*]] = extractelement <15 x i64> [[Y]], i64 4
; OPT-NEXT: [[TMP20:%.*]] = extractelement <15 x i64> [[Y]], i64 5
; OPT-NEXT: [[TMP21:%.*]] = extractelement <15 x i64> [[Y]], i64 6
; OPT-NEXT: [[TMP22:%.*]] = extractelement <15 x i64> [[Y]], i64 7
; OPT-NEXT: [[TMP23:%.*]] = extractelement <15 x i64> [[Y]], i64 8
; OPT-NEXT: [[TMP24:%.*]] = extractelement <15 x i64> [[Y]], i64 9
; OPT-NEXT: [[TMP25:%.*]] = extractelement <15 x i64> [[Y]], i64 10
; OPT-NEXT: [[TMP26:%.*]] = extractelement <15 x i64> [[Y]], i64 11
; OPT-NEXT: [[TMP27:%.*]] = extractelement <15 x i64> [[Y]], i64 12
; OPT-NEXT: [[TMP28:%.*]] = extractelement <15 x i64> [[Y]], i64 13
; OPT-NEXT: [[TMP29:%.*]] = extractelement <15 x i64> [[Y]], i64 14
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP30:%.*]] = phi i64 [ [[TMP0]], [[THEN]] ], [ [[TMP15]], [[ELSE]] ]
; OPT-NEXT: [[TMP31:%.*]] = phi i64 [ [[TMP1]], [[THEN]] ], [ [[TMP16]], [[ELSE]] ]
; OPT-NEXT: [[TMP32:%.*]] = phi i64 [ [[TMP2]], [[THEN]] ], [ [[TMP17]], [[ELSE]] ]
; OPT-NEXT: [[TMP33:%.*]] = phi i64 [ [[TMP3]], [[THEN]] ], [ [[TMP18]], [[ELSE]] ]
; OPT-NEXT: [[TMP34:%.*]] = phi i64 [ [[TMP4]], [[THEN]] ], [ [[TMP19]], [[ELSE]] ]
; OPT-NEXT: [[TMP35:%.*]] = phi i64 [ [[TMP5]], [[THEN]] ], [ [[TMP20]], [[ELSE]] ]
; OPT-NEXT: [[TMP36:%.*]] = phi i64 [ [[TMP6]], [[THEN]] ], [ [[TMP21]], [[ELSE]] ]
; OPT-NEXT: [[TMP37:%.*]] = phi i64 [ [[TMP7]], [[THEN]] ], [ [[TMP22]], [[ELSE]] ]
; OPT-NEXT: [[TMP38:%.*]] = phi i64 [ [[TMP8]], [[THEN]] ], [ [[TMP23]], [[ELSE]] ]
; OPT-NEXT: [[TMP39:%.*]] = phi i64 [ [[TMP9]], [[THEN]] ], [ [[TMP24]], [[ELSE]] ]
; OPT-NEXT: [[TMP40:%.*]] = phi i64 [ [[TMP10]], [[THEN]] ], [ [[TMP25]], [[ELSE]] ]
; OPT-NEXT: [[TMP41:%.*]] = phi i64 [ [[TMP11]], [[THEN]] ], [ [[TMP26]], [[ELSE]] ]
; OPT-NEXT: [[TMP42:%.*]] = phi i64 [ [[TMP12]], [[THEN]] ], [ [[TMP27]], [[ELSE]] ]
; OPT-NEXT: [[TMP43:%.*]] = phi i64 [ [[TMP13]], [[THEN]] ], [ [[TMP28]], [[ELSE]] ]
; OPT-NEXT: [[TMP44:%.*]] = phi i64 [ [[TMP14]], [[THEN]] ], [ [[TMP29]], [[ELSE]] ]
; OPT-NEXT: [[TMP45:%.*]] = insertelement <15 x i64> poison, i64 [[TMP30]], i64 0
; OPT-NEXT: [[TMP46:%.*]] = insertelement <15 x i64> [[TMP45]], i64 [[TMP31]], i64 1
; OPT-NEXT: [[TMP47:%.*]] = insertelement <15 x i64> [[TMP46]], i64 [[TMP32]], i64 2
; OPT-NEXT: [[TMP48:%.*]] = insertelement <15 x i64> [[TMP47]], i64 [[TMP33]], i64 3
; OPT-NEXT: [[TMP49:%.*]] = insertelement <15 x i64> [[TMP48]], i64 [[TMP34]], i64 4
; OPT-NEXT: [[TMP50:%.*]] = insertelement <15 x i64> [[TMP49]], i64 [[TMP35]], i64 5
; OPT-NEXT: [[TMP51:%.*]] = insertelement <15 x i64> [[TMP50]], i64 [[TMP36]], i64 6
; OPT-NEXT: [[TMP52:%.*]] = insertelement <15 x i64> [[TMP51]], i64 [[TMP37]], i64 7
; OPT-NEXT: [[TMP53:%.*]] = insertelement <15 x i64> [[TMP52]], i64 [[TMP38]], i64 8
; OPT-NEXT: [[TMP54:%.*]] = insertelement <15 x i64> [[TMP53]], i64 [[TMP39]], i64 9
; OPT-NEXT: [[TMP55:%.*]] = insertelement <15 x i64> [[TMP54]], i64 [[TMP40]], i64 10
; OPT-NEXT: [[TMP56:%.*]] = insertelement <15 x i64> [[TMP55]], i64 [[TMP41]], i64 11
; OPT-NEXT: [[TMP57:%.*]] = insertelement <15 x i64> [[TMP56]], i64 [[TMP42]], i64 12
; OPT-NEXT: [[TMP58:%.*]] = insertelement <15 x i64> [[TMP57]], i64 [[TMP43]], i64 13
; OPT-NEXT: [[TMP59:%.*]] = insertelement <15 x i64> [[TMP58]], i64 [[TMP44]], i64 14
; OPT-NEXT: store <15 x i64> [[TMP59]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v15i64(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <15 x i64> [[IN:%.*]], i64 42, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <15 x i64> [[IN]], i64 64, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <15 x i64> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <15 x i64> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <15 x i64> %in, i64 42, i32 3
br label %finally
else:
%y = insertelement <15 x i64> %in, i64 64, i32 6
br label %finally
finally:
%val = phi <15 x i64> [%x, %then], [%y, %else]
store <15 x i64> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v27i16(<27 x i16> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v27i16(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <27 x i16> [[IN:%.*]], i16 42, i32 3
; OPT-NEXT: [[TMP0:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 0, i32 1>
; OPT-NEXT: [[TMP1:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 2, i32 3>
; OPT-NEXT: [[TMP2:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 4, i32 5>
; OPT-NEXT: [[TMP3:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 6, i32 7>
; OPT-NEXT: [[TMP4:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 8, i32 9>
; OPT-NEXT: [[TMP5:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 10, i32 11>
; OPT-NEXT: [[TMP6:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 12, i32 13>
; OPT-NEXT: [[TMP7:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 14, i32 15>
; OPT-NEXT: [[TMP8:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 16, i32 17>
; OPT-NEXT: [[TMP9:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 18, i32 19>
; OPT-NEXT: [[TMP10:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 20, i32 21>
; OPT-NEXT: [[TMP11:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 22, i32 23>
; OPT-NEXT: [[TMP12:%.*]] = shufflevector <27 x i16> [[X]], <27 x i16> poison, <2 x i32> <i32 24, i32 25>
; OPT-NEXT: [[TMP13:%.*]] = extractelement <27 x i16> [[X]], i64 26
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <27 x i16> [[IN]], i16 64, i32 6
; OPT-NEXT: [[TMP14:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 0, i32 1>
; OPT-NEXT: [[TMP15:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 2, i32 3>
; OPT-NEXT: [[TMP16:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 4, i32 5>
; OPT-NEXT: [[TMP17:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 6, i32 7>
; OPT-NEXT: [[TMP18:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 8, i32 9>
; OPT-NEXT: [[TMP19:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 10, i32 11>
; OPT-NEXT: [[TMP20:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 12, i32 13>
; OPT-NEXT: [[TMP21:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 14, i32 15>
; OPT-NEXT: [[TMP22:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 16, i32 17>
; OPT-NEXT: [[TMP23:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 18, i32 19>
; OPT-NEXT: [[TMP24:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 20, i32 21>
; OPT-NEXT: [[TMP25:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 22, i32 23>
; OPT-NEXT: [[TMP26:%.*]] = shufflevector <27 x i16> [[Y]], <27 x i16> poison, <2 x i32> <i32 24, i32 25>
; OPT-NEXT: [[TMP27:%.*]] = extractelement <27 x i16> [[Y]], i64 26
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP28:%.*]] = phi <2 x i16> [ [[TMP0]], [[THEN]] ], [ [[TMP14]], [[ELSE]] ]
; OPT-NEXT: [[TMP29:%.*]] = phi <2 x i16> [ [[TMP1]], [[THEN]] ], [ [[TMP15]], [[ELSE]] ]
; OPT-NEXT: [[TMP30:%.*]] = phi <2 x i16> [ [[TMP2]], [[THEN]] ], [ [[TMP16]], [[ELSE]] ]
; OPT-NEXT: [[TMP31:%.*]] = phi <2 x i16> [ [[TMP3]], [[THEN]] ], [ [[TMP17]], [[ELSE]] ]
; OPT-NEXT: [[TMP32:%.*]] = phi <2 x i16> [ [[TMP4]], [[THEN]] ], [ [[TMP18]], [[ELSE]] ]
; OPT-NEXT: [[TMP33:%.*]] = phi <2 x i16> [ [[TMP5]], [[THEN]] ], [ [[TMP19]], [[ELSE]] ]
; OPT-NEXT: [[TMP34:%.*]] = phi <2 x i16> [ [[TMP6]], [[THEN]] ], [ [[TMP20]], [[ELSE]] ]
; OPT-NEXT: [[TMP35:%.*]] = phi <2 x i16> [ [[TMP7]], [[THEN]] ], [ [[TMP21]], [[ELSE]] ]
; OPT-NEXT: [[TMP36:%.*]] = phi <2 x i16> [ [[TMP8]], [[THEN]] ], [ [[TMP22]], [[ELSE]] ]
; OPT-NEXT: [[TMP37:%.*]] = phi <2 x i16> [ [[TMP9]], [[THEN]] ], [ [[TMP23]], [[ELSE]] ]
; OPT-NEXT: [[TMP38:%.*]] = phi <2 x i16> [ [[TMP10]], [[THEN]] ], [ [[TMP24]], [[ELSE]] ]
; OPT-NEXT: [[TMP39:%.*]] = phi <2 x i16> [ [[TMP11]], [[THEN]] ], [ [[TMP25]], [[ELSE]] ]
; OPT-NEXT: [[TMP40:%.*]] = phi <2 x i16> [ [[TMP12]], [[THEN]] ], [ [[TMP26]], [[ELSE]] ]
; OPT-NEXT: [[TMP41:%.*]] = phi i16 [ [[TMP13]], [[THEN]] ], [ [[TMP27]], [[ELSE]] ]
; OPT-NEXT: [[TMP42:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> poison, <2 x i16> [[TMP28]], i64 0)
; OPT-NEXT: [[TMP43:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP42]], <2 x i16> [[TMP29]], i64 2)
; OPT-NEXT: [[TMP44:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP43]], <2 x i16> [[TMP30]], i64 4)
; OPT-NEXT: [[TMP45:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP44]], <2 x i16> [[TMP31]], i64 6)
; OPT-NEXT: [[TMP46:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP45]], <2 x i16> [[TMP32]], i64 8)
; OPT-NEXT: [[TMP47:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP46]], <2 x i16> [[TMP33]], i64 10)
; OPT-NEXT: [[TMP48:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP47]], <2 x i16> [[TMP34]], i64 12)
; OPT-NEXT: [[TMP49:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP48]], <2 x i16> [[TMP35]], i64 14)
; OPT-NEXT: [[TMP50:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP49]], <2 x i16> [[TMP36]], i64 16)
; OPT-NEXT: [[TMP51:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP50]], <2 x i16> [[TMP37]], i64 18)
; OPT-NEXT: [[TMP52:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP51]], <2 x i16> [[TMP38]], i64 20)
; OPT-NEXT: [[TMP53:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP52]], <2 x i16> [[TMP39]], i64 22)
; OPT-NEXT: [[TMP54:%.*]] = call <27 x i16> @llvm.vector.insert.v27i16.v2i16(<27 x i16> [[TMP53]], <2 x i16> [[TMP40]], i64 24)
; OPT-NEXT: [[TMP55:%.*]] = insertelement <27 x i16> [[TMP54]], i16 [[TMP41]], i64 26
; OPT-NEXT: store <27 x i16> [[TMP55]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v27i16(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <27 x i16> [[IN:%.*]], i16 42, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <27 x i16> [[IN]], i16 64, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <27 x i16> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <27 x i16> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <27 x i16> %in, i16 42, i32 3
br label %finally
else:
%y = insertelement <27 x i16> %in, i16 64, i32 6
br label %finally
finally:
%val = phi <27 x i16> [%x, %then], [%y, %else]
store <27 x i16> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v23i8(<23 x i8> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v23i8(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <23 x i8> [[IN:%.*]], i8 42, i32 3
; OPT-NEXT: [[TMP0:%.*]] = shufflevector <23 x i8> [[X]], <23 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; OPT-NEXT: [[TMP1:%.*]] = shufflevector <23 x i8> [[X]], <23 x i8> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
; OPT-NEXT: [[TMP2:%.*]] = shufflevector <23 x i8> [[X]], <23 x i8> poison, <4 x i32> <i32 8, i32 9, i32 10, i32 11>
; OPT-NEXT: [[TMP3:%.*]] = shufflevector <23 x i8> [[X]], <23 x i8> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
; OPT-NEXT: [[TMP4:%.*]] = shufflevector <23 x i8> [[X]], <23 x i8> poison, <4 x i32> <i32 16, i32 17, i32 18, i32 19>
; OPT-NEXT: [[TMP5:%.*]] = extractelement <23 x i8> [[X]], i64 20
; OPT-NEXT: [[TMP6:%.*]] = extractelement <23 x i8> [[X]], i64 21
; OPT-NEXT: [[TMP7:%.*]] = extractelement <23 x i8> [[X]], i64 22
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <23 x i8> [[IN]], i8 64, i32 6
; OPT-NEXT: [[TMP8:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; OPT-NEXT: [[TMP9:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
; OPT-NEXT: [[TMP10:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 8, i32 9, i32 10, i32 11>
; OPT-NEXT: [[TMP11:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
; OPT-NEXT: [[TMP12:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 16, i32 17, i32 18, i32 19>
; OPT-NEXT: [[TMP13:%.*]] = extractelement <23 x i8> [[Y]], i64 20
; OPT-NEXT: [[TMP14:%.*]] = extractelement <23 x i8> [[Y]], i64 21
; OPT-NEXT: [[TMP15:%.*]] = extractelement <23 x i8> [[Y]], i64 22
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP16:%.*]] = phi <4 x i8> [ [[TMP0]], [[THEN]] ], [ [[TMP8]], [[ELSE]] ]
; OPT-NEXT: [[TMP17:%.*]] = phi <4 x i8> [ [[TMP1]], [[THEN]] ], [ [[TMP9]], [[ELSE]] ]
; OPT-NEXT: [[TMP18:%.*]] = phi <4 x i8> [ [[TMP2]], [[THEN]] ], [ [[TMP10]], [[ELSE]] ]
; OPT-NEXT: [[TMP19:%.*]] = phi <4 x i8> [ [[TMP3]], [[THEN]] ], [ [[TMP11]], [[ELSE]] ]
; OPT-NEXT: [[TMP20:%.*]] = phi <4 x i8> [ [[TMP4]], [[THEN]] ], [ [[TMP12]], [[ELSE]] ]
; OPT-NEXT: [[TMP21:%.*]] = phi i8 [ [[TMP5]], [[THEN]] ], [ [[TMP13]], [[ELSE]] ]
; OPT-NEXT: [[TMP22:%.*]] = phi i8 [ [[TMP6]], [[THEN]] ], [ [[TMP14]], [[ELSE]] ]
; OPT-NEXT: [[TMP23:%.*]] = phi i8 [ [[TMP7]], [[THEN]] ], [ [[TMP15]], [[ELSE]] ]
; OPT-NEXT: [[TMP24:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> poison, <4 x i8> [[TMP16]], i64 0)
; OPT-NEXT: [[TMP25:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP24]], <4 x i8> [[TMP17]], i64 4)
; OPT-NEXT: [[TMP26:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP25]], <4 x i8> [[TMP18]], i64 8)
; OPT-NEXT: [[TMP27:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP26]], <4 x i8> [[TMP19]], i64 12)
; OPT-NEXT: [[TMP28:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP27]], <4 x i8> [[TMP20]], i64 16)
; OPT-NEXT: [[TMP29:%.*]] = insertelement <23 x i8> [[TMP28]], i8 [[TMP21]], i64 20
; OPT-NEXT: [[TMP30:%.*]] = insertelement <23 x i8> [[TMP29]], i8 [[TMP22]], i64 21
; OPT-NEXT: [[TMP31:%.*]] = insertelement <23 x i8> [[TMP30]], i8 [[TMP23]], i64 22
; OPT-NEXT: store <23 x i8> [[TMP31]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v23i8(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <23 x i8> [[IN:%.*]], i8 42, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <23 x i8> [[IN]], i8 64, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <23 x i8> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <23 x i8> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <23 x i8> %in, i8 42, i32 3
br label %finally
else:
%y = insertelement <23 x i8> %in, i8 64, i32 6
br label %finally
finally:
%val = phi <23 x i8> [%x, %then], [%y, %else]
store <23 x i8> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v23i8_zeroinit(<23 x i8> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v23i8_zeroinit(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <23 x i8> [[IN:%.*]], i8 64, i32 6
; OPT-NEXT: [[TMP0:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; OPT-NEXT: [[TMP1:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
; OPT-NEXT: [[TMP2:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 8, i32 9, i32 10, i32 11>
; OPT-NEXT: [[TMP3:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
; OPT-NEXT: [[TMP4:%.*]] = shufflevector <23 x i8> [[Y]], <23 x i8> poison, <4 x i32> <i32 16, i32 17, i32 18, i32 19>
; OPT-NEXT: [[TMP5:%.*]] = extractelement <23 x i8> [[Y]], i64 20
; OPT-NEXT: [[TMP6:%.*]] = extractelement <23 x i8> [[Y]], i64 21
; OPT-NEXT: [[TMP7:%.*]] = extractelement <23 x i8> [[Y]], i64 22
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP8:%.*]] = phi <4 x i8> [ zeroinitializer, [[THEN]] ], [ [[TMP0]], [[ELSE]] ]
; OPT-NEXT: [[TMP9:%.*]] = phi <4 x i8> [ zeroinitializer, [[THEN]] ], [ [[TMP1]], [[ELSE]] ]
; OPT-NEXT: [[TMP10:%.*]] = phi <4 x i8> [ zeroinitializer, [[THEN]] ], [ [[TMP2]], [[ELSE]] ]
; OPT-NEXT: [[TMP11:%.*]] = phi <4 x i8> [ zeroinitializer, [[THEN]] ], [ [[TMP3]], [[ELSE]] ]
; OPT-NEXT: [[TMP12:%.*]] = phi <4 x i8> [ zeroinitializer, [[THEN]] ], [ [[TMP4]], [[ELSE]] ]
; OPT-NEXT: [[TMP13:%.*]] = phi i8 [ 0, [[THEN]] ], [ [[TMP5]], [[ELSE]] ]
; OPT-NEXT: [[TMP14:%.*]] = phi i8 [ 0, [[THEN]] ], [ [[TMP6]], [[ELSE]] ]
; OPT-NEXT: [[TMP15:%.*]] = phi i8 [ 0, [[THEN]] ], [ [[TMP7]], [[ELSE]] ]
; OPT-NEXT: [[TMP16:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> poison, <4 x i8> [[TMP8]], i64 0)
; OPT-NEXT: [[TMP17:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP16]], <4 x i8> [[TMP9]], i64 4)
; OPT-NEXT: [[TMP18:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP17]], <4 x i8> [[TMP10]], i64 8)
; OPT-NEXT: [[TMP19:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP18]], <4 x i8> [[TMP11]], i64 12)
; OPT-NEXT: [[TMP20:%.*]] = call <23 x i8> @llvm.vector.insert.v23i8.v4i8(<23 x i8> [[TMP19]], <4 x i8> [[TMP12]], i64 16)
; OPT-NEXT: [[TMP21:%.*]] = insertelement <23 x i8> [[TMP20]], i8 [[TMP13]], i64 20
; OPT-NEXT: [[TMP22:%.*]] = insertelement <23 x i8> [[TMP21]], i8 [[TMP14]], i64 21
; OPT-NEXT: [[TMP23:%.*]] = insertelement <23 x i8> [[TMP22]], i8 [[TMP15]], i64 22
; OPT-NEXT: store <23 x i8> [[TMP23]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v23i8_zeroinit(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <23 x i8> [[IN:%.*]], i8 64, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <23 x i8> [ zeroinitializer, [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <23 x i8> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
br label %finally
else:
%y = insertelement <23 x i8> %in, i8 64, i32 6
br label %finally
finally:
%val = phi <23 x i8> [zeroinitializer, %then], [%y, %else]
store <23 x i8> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v15i8_random_constant_init(<15 x i8> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v15i8_random_constant_init(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <15 x i8> [[IN:%.*]], i8 64, i32 6
; OPT-NEXT: [[TMP0:%.*]] = shufflevector <15 x i8> [[Y]], <15 x i8> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
; OPT-NEXT: [[TMP1:%.*]] = shufflevector <15 x i8> [[Y]], <15 x i8> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
; OPT-NEXT: [[TMP2:%.*]] = shufflevector <15 x i8> [[Y]], <15 x i8> poison, <4 x i32> <i32 8, i32 9, i32 10, i32 11>
; OPT-NEXT: [[TMP3:%.*]] = extractelement <15 x i8> [[Y]], i64 12
; OPT-NEXT: [[TMP4:%.*]] = extractelement <15 x i8> [[Y]], i64 13
; OPT-NEXT: [[TMP5:%.*]] = extractelement <15 x i8> [[Y]], i64 14
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP6:%.*]] = phi <4 x i8> [ <i8 poison, i8 1, i8 2, i8 3>, [[THEN]] ], [ [[TMP0]], [[ELSE]] ]
; OPT-NEXT: [[TMP7:%.*]] = phi <4 x i8> [ <i8 4, i8 undef, i8 6, i8 7>, [[THEN]] ], [ [[TMP1]], [[ELSE]] ]
; OPT-NEXT: [[TMP8:%.*]] = phi <4 x i8> [ <i8 9, i8 10, i8 11, i8 12>, [[THEN]] ], [ [[TMP2]], [[ELSE]] ]
; OPT-NEXT: [[TMP9:%.*]] = phi i8 [ 13, [[THEN]] ], [ [[TMP3]], [[ELSE]] ]
; OPT-NEXT: [[TMP10:%.*]] = phi i8 [ 14, [[THEN]] ], [ [[TMP4]], [[ELSE]] ]
; OPT-NEXT: [[TMP11:%.*]] = phi i8 [ undef, [[THEN]] ], [ [[TMP5]], [[ELSE]] ]
; OPT-NEXT: [[TMP12:%.*]] = call <15 x i8> @llvm.vector.insert.v15i8.v4i8(<15 x i8> poison, <4 x i8> [[TMP6]], i64 0)
; OPT-NEXT: [[TMP13:%.*]] = call <15 x i8> @llvm.vector.insert.v15i8.v4i8(<15 x i8> [[TMP12]], <4 x i8> [[TMP7]], i64 4)
; OPT-NEXT: [[TMP14:%.*]] = call <15 x i8> @llvm.vector.insert.v15i8.v4i8(<15 x i8> [[TMP13]], <4 x i8> [[TMP8]], i64 8)
; OPT-NEXT: [[TMP15:%.*]] = insertelement <15 x i8> [[TMP14]], i8 [[TMP9]], i64 12
; OPT-NEXT: [[TMP16:%.*]] = insertelement <15 x i8> [[TMP15]], i8 [[TMP10]], i64 13
; OPT-NEXT: [[TMP17:%.*]] = insertelement <15 x i8> [[TMP16]], i8 [[TMP11]], i64 14
; OPT-NEXT: store <15 x i8> [[TMP17]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v15i8_random_constant_init(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <15 x i8> [[IN:%.*]], i8 64, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <15 x i8> [ <i8 poison, i8 1, i8 2, i8 3, i8 4, i8 undef, i8 6, i8 7, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 undef>, [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <15 x i8> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
br label %finally
else:
%y = insertelement <15 x i8> %in, i8 64, i32 6
br label %finally
finally:
%val = phi <15 x i8> [<i8 poison, i8 1, i8 2, i8 3, i8 4, i8 undef, i8 6, i8 7, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 undef>, %then], [%y, %else]
store <15 x i8> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v23i32(<23 x i32> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v23i32(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <23 x i32> [[IN:%.*]], i32 42, i32 3
; OPT-NEXT: [[TMP0:%.*]] = extractelement <23 x i32> [[X]], i64 0
; OPT-NEXT: [[TMP1:%.*]] = extractelement <23 x i32> [[X]], i64 1
; OPT-NEXT: [[TMP2:%.*]] = extractelement <23 x i32> [[X]], i64 2
; OPT-NEXT: [[TMP3:%.*]] = extractelement <23 x i32> [[X]], i64 3
; OPT-NEXT: [[TMP4:%.*]] = extractelement <23 x i32> [[X]], i64 4
; OPT-NEXT: [[TMP5:%.*]] = extractelement <23 x i32> [[X]], i64 5
; OPT-NEXT: [[TMP6:%.*]] = extractelement <23 x i32> [[X]], i64 6
; OPT-NEXT: [[TMP7:%.*]] = extractelement <23 x i32> [[X]], i64 7
; OPT-NEXT: [[TMP8:%.*]] = extractelement <23 x i32> [[X]], i64 8
; OPT-NEXT: [[TMP9:%.*]] = extractelement <23 x i32> [[X]], i64 9
; OPT-NEXT: [[TMP10:%.*]] = extractelement <23 x i32> [[X]], i64 10
; OPT-NEXT: [[TMP11:%.*]] = extractelement <23 x i32> [[X]], i64 11
; OPT-NEXT: [[TMP12:%.*]] = extractelement <23 x i32> [[X]], i64 12
; OPT-NEXT: [[TMP13:%.*]] = extractelement <23 x i32> [[X]], i64 13
; OPT-NEXT: [[TMP14:%.*]] = extractelement <23 x i32> [[X]], i64 14
; OPT-NEXT: [[TMP15:%.*]] = extractelement <23 x i32> [[X]], i64 15
; OPT-NEXT: [[TMP16:%.*]] = extractelement <23 x i32> [[X]], i64 16
; OPT-NEXT: [[TMP17:%.*]] = extractelement <23 x i32> [[X]], i64 17
; OPT-NEXT: [[TMP18:%.*]] = extractelement <23 x i32> [[X]], i64 18
; OPT-NEXT: [[TMP19:%.*]] = extractelement <23 x i32> [[X]], i64 19
; OPT-NEXT: [[TMP20:%.*]] = extractelement <23 x i32> [[X]], i64 20
; OPT-NEXT: [[TMP21:%.*]] = extractelement <23 x i32> [[X]], i64 21
; OPT-NEXT: [[TMP22:%.*]] = extractelement <23 x i32> [[X]], i64 22
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <23 x i32> [[IN]], i32 64, i32 6
; OPT-NEXT: [[TMP23:%.*]] = extractelement <23 x i32> [[Y]], i64 0
; OPT-NEXT: [[TMP24:%.*]] = extractelement <23 x i32> [[Y]], i64 1
; OPT-NEXT: [[TMP25:%.*]] = extractelement <23 x i32> [[Y]], i64 2
; OPT-NEXT: [[TMP26:%.*]] = extractelement <23 x i32> [[Y]], i64 3
; OPT-NEXT: [[TMP27:%.*]] = extractelement <23 x i32> [[Y]], i64 4
; OPT-NEXT: [[TMP28:%.*]] = extractelement <23 x i32> [[Y]], i64 5
; OPT-NEXT: [[TMP29:%.*]] = extractelement <23 x i32> [[Y]], i64 6
; OPT-NEXT: [[TMP30:%.*]] = extractelement <23 x i32> [[Y]], i64 7
; OPT-NEXT: [[TMP31:%.*]] = extractelement <23 x i32> [[Y]], i64 8
; OPT-NEXT: [[TMP32:%.*]] = extractelement <23 x i32> [[Y]], i64 9
; OPT-NEXT: [[TMP33:%.*]] = extractelement <23 x i32> [[Y]], i64 10
; OPT-NEXT: [[TMP34:%.*]] = extractelement <23 x i32> [[Y]], i64 11
; OPT-NEXT: [[TMP35:%.*]] = extractelement <23 x i32> [[Y]], i64 12
; OPT-NEXT: [[TMP36:%.*]] = extractelement <23 x i32> [[Y]], i64 13
; OPT-NEXT: [[TMP37:%.*]] = extractelement <23 x i32> [[Y]], i64 14
; OPT-NEXT: [[TMP38:%.*]] = extractelement <23 x i32> [[Y]], i64 15
; OPT-NEXT: [[TMP39:%.*]] = extractelement <23 x i32> [[Y]], i64 16
; OPT-NEXT: [[TMP40:%.*]] = extractelement <23 x i32> [[Y]], i64 17
; OPT-NEXT: [[TMP41:%.*]] = extractelement <23 x i32> [[Y]], i64 18
; OPT-NEXT: [[TMP42:%.*]] = extractelement <23 x i32> [[Y]], i64 19
; OPT-NEXT: [[TMP43:%.*]] = extractelement <23 x i32> [[Y]], i64 20
; OPT-NEXT: [[TMP44:%.*]] = extractelement <23 x i32> [[Y]], i64 21
; OPT-NEXT: [[TMP45:%.*]] = extractelement <23 x i32> [[Y]], i64 22
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP46:%.*]] = phi i32 [ [[TMP0]], [[THEN]] ], [ [[TMP23]], [[ELSE]] ]
; OPT-NEXT: [[TMP47:%.*]] = phi i32 [ [[TMP1]], [[THEN]] ], [ [[TMP24]], [[ELSE]] ]
; OPT-NEXT: [[TMP48:%.*]] = phi i32 [ [[TMP2]], [[THEN]] ], [ [[TMP25]], [[ELSE]] ]
; OPT-NEXT: [[TMP49:%.*]] = phi i32 [ [[TMP3]], [[THEN]] ], [ [[TMP26]], [[ELSE]] ]
; OPT-NEXT: [[TMP50:%.*]] = phi i32 [ [[TMP4]], [[THEN]] ], [ [[TMP27]], [[ELSE]] ]
; OPT-NEXT: [[TMP51:%.*]] = phi i32 [ [[TMP5]], [[THEN]] ], [ [[TMP28]], [[ELSE]] ]
; OPT-NEXT: [[TMP52:%.*]] = phi i32 [ [[TMP6]], [[THEN]] ], [ [[TMP29]], [[ELSE]] ]
; OPT-NEXT: [[TMP53:%.*]] = phi i32 [ [[TMP7]], [[THEN]] ], [ [[TMP30]], [[ELSE]] ]
; OPT-NEXT: [[TMP54:%.*]] = phi i32 [ [[TMP8]], [[THEN]] ], [ [[TMP31]], [[ELSE]] ]
; OPT-NEXT: [[TMP55:%.*]] = phi i32 [ [[TMP9]], [[THEN]] ], [ [[TMP32]], [[ELSE]] ]
; OPT-NEXT: [[TMP56:%.*]] = phi i32 [ [[TMP10]], [[THEN]] ], [ [[TMP33]], [[ELSE]] ]
; OPT-NEXT: [[TMP57:%.*]] = phi i32 [ [[TMP11]], [[THEN]] ], [ [[TMP34]], [[ELSE]] ]
; OPT-NEXT: [[TMP58:%.*]] = phi i32 [ [[TMP12]], [[THEN]] ], [ [[TMP35]], [[ELSE]] ]
; OPT-NEXT: [[TMP59:%.*]] = phi i32 [ [[TMP13]], [[THEN]] ], [ [[TMP36]], [[ELSE]] ]
; OPT-NEXT: [[TMP60:%.*]] = phi i32 [ [[TMP14]], [[THEN]] ], [ [[TMP37]], [[ELSE]] ]
; OPT-NEXT: [[TMP61:%.*]] = phi i32 [ [[TMP15]], [[THEN]] ], [ [[TMP38]], [[ELSE]] ]
; OPT-NEXT: [[TMP62:%.*]] = phi i32 [ [[TMP16]], [[THEN]] ], [ [[TMP39]], [[ELSE]] ]
; OPT-NEXT: [[TMP63:%.*]] = phi i32 [ [[TMP17]], [[THEN]] ], [ [[TMP40]], [[ELSE]] ]
; OPT-NEXT: [[TMP64:%.*]] = phi i32 [ [[TMP18]], [[THEN]] ], [ [[TMP41]], [[ELSE]] ]
; OPT-NEXT: [[TMP65:%.*]] = phi i32 [ [[TMP19]], [[THEN]] ], [ [[TMP42]], [[ELSE]] ]
; OPT-NEXT: [[TMP66:%.*]] = phi i32 [ [[TMP20]], [[THEN]] ], [ [[TMP43]], [[ELSE]] ]
; OPT-NEXT: [[TMP67:%.*]] = phi i32 [ [[TMP21]], [[THEN]] ], [ [[TMP44]], [[ELSE]] ]
; OPT-NEXT: [[TMP68:%.*]] = phi i32 [ [[TMP22]], [[THEN]] ], [ [[TMP45]], [[ELSE]] ]
; OPT-NEXT: [[TMP69:%.*]] = insertelement <23 x i32> poison, i32 [[TMP46]], i64 0
; OPT-NEXT: [[TMP70:%.*]] = insertelement <23 x i32> [[TMP69]], i32 [[TMP47]], i64 1
; OPT-NEXT: [[TMP71:%.*]] = insertelement <23 x i32> [[TMP70]], i32 [[TMP48]], i64 2
; OPT-NEXT: [[TMP72:%.*]] = insertelement <23 x i32> [[TMP71]], i32 [[TMP49]], i64 3
; OPT-NEXT: [[TMP73:%.*]] = insertelement <23 x i32> [[TMP72]], i32 [[TMP50]], i64 4
; OPT-NEXT: [[TMP74:%.*]] = insertelement <23 x i32> [[TMP73]], i32 [[TMP51]], i64 5
; OPT-NEXT: [[TMP75:%.*]] = insertelement <23 x i32> [[TMP74]], i32 [[TMP52]], i64 6
; OPT-NEXT: [[TMP76:%.*]] = insertelement <23 x i32> [[TMP75]], i32 [[TMP53]], i64 7
; OPT-NEXT: [[TMP77:%.*]] = insertelement <23 x i32> [[TMP76]], i32 [[TMP54]], i64 8
; OPT-NEXT: [[TMP78:%.*]] = insertelement <23 x i32> [[TMP77]], i32 [[TMP55]], i64 9
; OPT-NEXT: [[TMP79:%.*]] = insertelement <23 x i32> [[TMP78]], i32 [[TMP56]], i64 10
; OPT-NEXT: [[TMP80:%.*]] = insertelement <23 x i32> [[TMP79]], i32 [[TMP57]], i64 11
; OPT-NEXT: [[TMP81:%.*]] = insertelement <23 x i32> [[TMP80]], i32 [[TMP58]], i64 12
; OPT-NEXT: [[TMP82:%.*]] = insertelement <23 x i32> [[TMP81]], i32 [[TMP59]], i64 13
; OPT-NEXT: [[TMP83:%.*]] = insertelement <23 x i32> [[TMP82]], i32 [[TMP60]], i64 14
; OPT-NEXT: [[TMP84:%.*]] = insertelement <23 x i32> [[TMP83]], i32 [[TMP61]], i64 15
; OPT-NEXT: [[TMP85:%.*]] = insertelement <23 x i32> [[TMP84]], i32 [[TMP62]], i64 16
; OPT-NEXT: [[TMP86:%.*]] = insertelement <23 x i32> [[TMP85]], i32 [[TMP63]], i64 17
; OPT-NEXT: [[TMP87:%.*]] = insertelement <23 x i32> [[TMP86]], i32 [[TMP64]], i64 18
; OPT-NEXT: [[TMP88:%.*]] = insertelement <23 x i32> [[TMP87]], i32 [[TMP65]], i64 19
; OPT-NEXT: [[TMP89:%.*]] = insertelement <23 x i32> [[TMP88]], i32 [[TMP66]], i64 20
; OPT-NEXT: [[TMP90:%.*]] = insertelement <23 x i32> [[TMP89]], i32 [[TMP67]], i64 21
; OPT-NEXT: [[TMP91:%.*]] = insertelement <23 x i32> [[TMP90]], i32 [[TMP68]], i64 22
; OPT-NEXT: store <23 x i32> [[TMP91]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v23i32(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <23 x i32> [[IN:%.*]], i32 42, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <23 x i32> [[IN]], i32 64, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <23 x i32> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <23 x i32> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <23 x i32> %in, i32 42, i32 3
br label %finally
else:
%y = insertelement <23 x i32> %in, i32 64, i32 6
br label %finally
finally:
%val = phi <23 x i32> [%x, %then], [%y, %else]
store <23 x i32> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v16i64(<16 x i64> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v16i64(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <16 x i64> [[IN:%.*]], i64 42, i32 3
; OPT-NEXT: [[TMP0:%.*]] = extractelement <16 x i64> [[X]], i64 0
; OPT-NEXT: [[TMP1:%.*]] = extractelement <16 x i64> [[X]], i64 1
; OPT-NEXT: [[TMP2:%.*]] = extractelement <16 x i64> [[X]], i64 2
; OPT-NEXT: [[TMP3:%.*]] = extractelement <16 x i64> [[X]], i64 3
; OPT-NEXT: [[TMP4:%.*]] = extractelement <16 x i64> [[X]], i64 4
; OPT-NEXT: [[TMP5:%.*]] = extractelement <16 x i64> [[X]], i64 5
; OPT-NEXT: [[TMP6:%.*]] = extractelement <16 x i64> [[X]], i64 6
; OPT-NEXT: [[TMP7:%.*]] = extractelement <16 x i64> [[X]], i64 7
; OPT-NEXT: [[TMP8:%.*]] = extractelement <16 x i64> [[X]], i64 8
; OPT-NEXT: [[TMP9:%.*]] = extractelement <16 x i64> [[X]], i64 9
; OPT-NEXT: [[TMP10:%.*]] = extractelement <16 x i64> [[X]], i64 10
; OPT-NEXT: [[TMP11:%.*]] = extractelement <16 x i64> [[X]], i64 11
; OPT-NEXT: [[TMP12:%.*]] = extractelement <16 x i64> [[X]], i64 12
; OPT-NEXT: [[TMP13:%.*]] = extractelement <16 x i64> [[X]], i64 13
; OPT-NEXT: [[TMP14:%.*]] = extractelement <16 x i64> [[X]], i64 14
; OPT-NEXT: [[TMP15:%.*]] = extractelement <16 x i64> [[X]], i64 15
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <16 x i64> [[IN]], i64 64, i32 6
; OPT-NEXT: [[TMP16:%.*]] = extractelement <16 x i64> [[Y]], i64 0
; OPT-NEXT: [[TMP17:%.*]] = extractelement <16 x i64> [[Y]], i64 1
; OPT-NEXT: [[TMP18:%.*]] = extractelement <16 x i64> [[Y]], i64 2
; OPT-NEXT: [[TMP19:%.*]] = extractelement <16 x i64> [[Y]], i64 3
; OPT-NEXT: [[TMP20:%.*]] = extractelement <16 x i64> [[Y]], i64 4
; OPT-NEXT: [[TMP21:%.*]] = extractelement <16 x i64> [[Y]], i64 5
; OPT-NEXT: [[TMP22:%.*]] = extractelement <16 x i64> [[Y]], i64 6
; OPT-NEXT: [[TMP23:%.*]] = extractelement <16 x i64> [[Y]], i64 7
; OPT-NEXT: [[TMP24:%.*]] = extractelement <16 x i64> [[Y]], i64 8
; OPT-NEXT: [[TMP25:%.*]] = extractelement <16 x i64> [[Y]], i64 9
; OPT-NEXT: [[TMP26:%.*]] = extractelement <16 x i64> [[Y]], i64 10
; OPT-NEXT: [[TMP27:%.*]] = extractelement <16 x i64> [[Y]], i64 11
; OPT-NEXT: [[TMP28:%.*]] = extractelement <16 x i64> [[Y]], i64 12
; OPT-NEXT: [[TMP29:%.*]] = extractelement <16 x i64> [[Y]], i64 13
; OPT-NEXT: [[TMP30:%.*]] = extractelement <16 x i64> [[Y]], i64 14
; OPT-NEXT: [[TMP31:%.*]] = extractelement <16 x i64> [[Y]], i64 15
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP32:%.*]] = phi i64 [ [[TMP0]], [[THEN]] ], [ [[TMP16]], [[ELSE]] ]
; OPT-NEXT: [[TMP33:%.*]] = phi i64 [ [[TMP1]], [[THEN]] ], [ [[TMP17]], [[ELSE]] ]
; OPT-NEXT: [[TMP34:%.*]] = phi i64 [ [[TMP2]], [[THEN]] ], [ [[TMP18]], [[ELSE]] ]
; OPT-NEXT: [[TMP35:%.*]] = phi i64 [ [[TMP3]], [[THEN]] ], [ [[TMP19]], [[ELSE]] ]
; OPT-NEXT: [[TMP36:%.*]] = phi i64 [ [[TMP4]], [[THEN]] ], [ [[TMP20]], [[ELSE]] ]
; OPT-NEXT: [[TMP37:%.*]] = phi i64 [ [[TMP5]], [[THEN]] ], [ [[TMP21]], [[ELSE]] ]
; OPT-NEXT: [[TMP38:%.*]] = phi i64 [ [[TMP6]], [[THEN]] ], [ [[TMP22]], [[ELSE]] ]
; OPT-NEXT: [[TMP39:%.*]] = phi i64 [ [[TMP7]], [[THEN]] ], [ [[TMP23]], [[ELSE]] ]
; OPT-NEXT: [[TMP40:%.*]] = phi i64 [ [[TMP8]], [[THEN]] ], [ [[TMP24]], [[ELSE]] ]
; OPT-NEXT: [[TMP41:%.*]] = phi i64 [ [[TMP9]], [[THEN]] ], [ [[TMP25]], [[ELSE]] ]
; OPT-NEXT: [[TMP42:%.*]] = phi i64 [ [[TMP10]], [[THEN]] ], [ [[TMP26]], [[ELSE]] ]
; OPT-NEXT: [[TMP43:%.*]] = phi i64 [ [[TMP11]], [[THEN]] ], [ [[TMP27]], [[ELSE]] ]
; OPT-NEXT: [[TMP44:%.*]] = phi i64 [ [[TMP12]], [[THEN]] ], [ [[TMP28]], [[ELSE]] ]
; OPT-NEXT: [[TMP45:%.*]] = phi i64 [ [[TMP13]], [[THEN]] ], [ [[TMP29]], [[ELSE]] ]
; OPT-NEXT: [[TMP46:%.*]] = phi i64 [ [[TMP14]], [[THEN]] ], [ [[TMP30]], [[ELSE]] ]
; OPT-NEXT: [[TMP47:%.*]] = phi i64 [ [[TMP15]], [[THEN]] ], [ [[TMP31]], [[ELSE]] ]
; OPT-NEXT: [[TMP48:%.*]] = insertelement <16 x i64> poison, i64 [[TMP32]], i64 0
; OPT-NEXT: [[TMP49:%.*]] = insertelement <16 x i64> [[TMP48]], i64 [[TMP33]], i64 1
; OPT-NEXT: [[TMP50:%.*]] = insertelement <16 x i64> [[TMP49]], i64 [[TMP34]], i64 2
; OPT-NEXT: [[TMP51:%.*]] = insertelement <16 x i64> [[TMP50]], i64 [[TMP35]], i64 3
; OPT-NEXT: [[TMP52:%.*]] = insertelement <16 x i64> [[TMP51]], i64 [[TMP36]], i64 4
; OPT-NEXT: [[TMP53:%.*]] = insertelement <16 x i64> [[TMP52]], i64 [[TMP37]], i64 5
; OPT-NEXT: [[TMP54:%.*]] = insertelement <16 x i64> [[TMP53]], i64 [[TMP38]], i64 6
; OPT-NEXT: [[TMP55:%.*]] = insertelement <16 x i64> [[TMP54]], i64 [[TMP39]], i64 7
; OPT-NEXT: [[TMP56:%.*]] = insertelement <16 x i64> [[TMP55]], i64 [[TMP40]], i64 8
; OPT-NEXT: [[TMP57:%.*]] = insertelement <16 x i64> [[TMP56]], i64 [[TMP41]], i64 9
; OPT-NEXT: [[TMP58:%.*]] = insertelement <16 x i64> [[TMP57]], i64 [[TMP42]], i64 10
; OPT-NEXT: [[TMP59:%.*]] = insertelement <16 x i64> [[TMP58]], i64 [[TMP43]], i64 11
; OPT-NEXT: [[TMP60:%.*]] = insertelement <16 x i64> [[TMP59]], i64 [[TMP44]], i64 12
; OPT-NEXT: [[TMP61:%.*]] = insertelement <16 x i64> [[TMP60]], i64 [[TMP45]], i64 13
; OPT-NEXT: [[TMP62:%.*]] = insertelement <16 x i64> [[TMP61]], i64 [[TMP46]], i64 14
; OPT-NEXT: [[TMP63:%.*]] = insertelement <16 x i64> [[TMP62]], i64 [[TMP47]], i64 15
; OPT-NEXT: store <16 x i64> [[TMP63]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v16i64(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <16 x i64> [[IN:%.*]], i64 42, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <16 x i64> [[IN]], i64 64, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <16 x i64> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <16 x i64> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <16 x i64> %in, i64 42, i32 3
br label %finally
else:
%y = insertelement <16 x i64> %in, i64 64, i32 6
br label %finally
finally:
%val = phi <16 x i64> [%x, %then], [%y, %else]
store <16 x i64> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v7i16(<7 x i16> %in, ptr %out, i1 %cond) {
; OPT-LABEL: @phi_v7i16(
; OPT-NEXT: entry:
; OPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; OPT: then:
; OPT-NEXT: [[X:%.*]] = insertelement <7 x i16> [[IN:%.*]], i16 3, i32 3
; OPT-NEXT: [[TMP0:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 0, i32 1>
; OPT-NEXT: [[TMP1:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 2, i32 3>
; OPT-NEXT: [[TMP2:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 4, i32 5>
; OPT-NEXT: [[TMP3:%.*]] = extractelement <7 x i16> [[X]], i64 6
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <7 x i16> [[IN]], i16 9, i32 6
; OPT-NEXT: [[TMP4:%.*]] = shufflevector <7 x i16> [[Y]], <7 x i16> poison, <2 x i32> <i32 0, i32 1>
; OPT-NEXT: [[TMP5:%.*]] = shufflevector <7 x i16> [[Y]], <7 x i16> poison, <2 x i32> <i32 2, i32 3>
; OPT-NEXT: [[TMP6:%.*]] = shufflevector <7 x i16> [[Y]], <7 x i16> poison, <2 x i32> <i32 4, i32 5>
; OPT-NEXT: [[TMP7:%.*]] = extractelement <7 x i16> [[Y]], i64 6
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP8:%.*]] = phi <2 x i16> [ [[TMP0]], [[THEN]] ], [ [[TMP4]], [[ELSE]] ]
; OPT-NEXT: [[TMP9:%.*]] = phi <2 x i16> [ [[TMP1]], [[THEN]] ], [ [[TMP5]], [[ELSE]] ]
; OPT-NEXT: [[TMP10:%.*]] = phi <2 x i16> [ [[TMP2]], [[THEN]] ], [ [[TMP6]], [[ELSE]] ]
; OPT-NEXT: [[TMP11:%.*]] = phi i16 [ [[TMP3]], [[THEN]] ], [ [[TMP7]], [[ELSE]] ]
; OPT-NEXT: [[TMP12:%.*]] = call <7 x i16> @llvm.vector.insert.v7i16.v2i16(<7 x i16> poison, <2 x i16> [[TMP8]], i64 0)
; OPT-NEXT: [[TMP13:%.*]] = call <7 x i16> @llvm.vector.insert.v7i16.v2i16(<7 x i16> [[TMP12]], <2 x i16> [[TMP9]], i64 2)
; OPT-NEXT: [[TMP14:%.*]] = call <7 x i16> @llvm.vector.insert.v7i16.v2i16(<7 x i16> [[TMP13]], <2 x i16> [[TMP10]], i64 4)
; OPT-NEXT: [[TMP15:%.*]] = insertelement <7 x i16> [[TMP14]], i16 [[TMP11]], i64 6
; OPT-NEXT: store <7 x i16> [[TMP15]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v7i16(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: br i1 [[COND:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
; NOOPT: then:
; NOOPT-NEXT: [[X:%.*]] = insertelement <7 x i16> [[IN:%.*]], i16 3, i32 3
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <7 x i16> [[IN]], i16 9, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <7 x i16> [ [[X]], [[THEN]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <7 x i16> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
br i1 %cond, label %then, label %else
then:
%x = insertelement <7 x i16> %in, i16 3, i32 3
br label %finally
else:
%y = insertelement <7 x i16> %in, i16 9, i32 6
br label %finally
finally:
%val = phi <7 x i16> [%x, %then], [%y, %else]
store <7 x i16> %val, ptr %out, align 1
ret void
}
define amdgpu_kernel void @phi_v7i16_switch(<7 x i16> %in, ptr %out, i8 %cond) {
; OPT-LABEL: @phi_v7i16_switch(
; OPT-NEXT: entry:
; OPT-NEXT: [[X:%.*]] = insertelement <7 x i16> [[IN:%.*]], i16 3, i32 3
; OPT-NEXT: switch i8 [[COND:%.*]], label [[ELSE:%.*]] [
; OPT-NEXT: i8 0, label [[THEN_1:%.*]]
; OPT-NEXT: i8 3, label [[THEN_2:%.*]]
; OPT-NEXT: ]
; OPT: then.1:
; OPT-NEXT: [[TMP0:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 0, i32 1>
; OPT-NEXT: [[TMP1:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 2, i32 3>
; OPT-NEXT: [[TMP2:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 4, i32 5>
; OPT-NEXT: [[TMP3:%.*]] = extractelement <7 x i16> [[X]], i64 6
; OPT-NEXT: br label [[FINALLY:%.*]]
; OPT: then.2:
; OPT-NEXT: [[TMP4:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 0, i32 1>
; OPT-NEXT: [[TMP5:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 2, i32 3>
; OPT-NEXT: [[TMP6:%.*]] = shufflevector <7 x i16> [[X]], <7 x i16> poison, <2 x i32> <i32 4, i32 5>
; OPT-NEXT: [[TMP7:%.*]] = extractelement <7 x i16> [[X]], i64 6
; OPT-NEXT: br label [[FINALLY]]
; OPT: else:
; OPT-NEXT: [[Y:%.*]] = insertelement <7 x i16> [[IN]], i16 9, i32 6
; OPT-NEXT: [[TMP8:%.*]] = shufflevector <7 x i16> [[Y]], <7 x i16> poison, <2 x i32> <i32 0, i32 1>
; OPT-NEXT: [[TMP9:%.*]] = shufflevector <7 x i16> [[Y]], <7 x i16> poison, <2 x i32> <i32 2, i32 3>
; OPT-NEXT: [[TMP10:%.*]] = shufflevector <7 x i16> [[Y]], <7 x i16> poison, <2 x i32> <i32 4, i32 5>
; OPT-NEXT: [[TMP11:%.*]] = extractelement <7 x i16> [[Y]], i64 6
; OPT-NEXT: br label [[FINALLY]]
; OPT: finally:
; OPT-NEXT: [[TMP12:%.*]] = phi <2 x i16> [ [[TMP0]], [[THEN_1]] ], [ [[TMP4]], [[THEN_2]] ], [ [[TMP8]], [[ELSE]] ]
; OPT-NEXT: [[TMP13:%.*]] = phi <2 x i16> [ [[TMP1]], [[THEN_1]] ], [ [[TMP5]], [[THEN_2]] ], [ [[TMP9]], [[ELSE]] ]
; OPT-NEXT: [[TMP14:%.*]] = phi <2 x i16> [ [[TMP2]], [[THEN_1]] ], [ [[TMP6]], [[THEN_2]] ], [ [[TMP10]], [[ELSE]] ]
; OPT-NEXT: [[TMP15:%.*]] = phi i16 [ [[TMP3]], [[THEN_1]] ], [ [[TMP7]], [[THEN_2]] ], [ [[TMP11]], [[ELSE]] ]
; OPT-NEXT: [[TMP16:%.*]] = call <7 x i16> @llvm.vector.insert.v7i16.v2i16(<7 x i16> poison, <2 x i16> [[TMP12]], i64 0)
; OPT-NEXT: [[TMP17:%.*]] = call <7 x i16> @llvm.vector.insert.v7i16.v2i16(<7 x i16> [[TMP16]], <2 x i16> [[TMP13]], i64 2)
; OPT-NEXT: [[TMP18:%.*]] = call <7 x i16> @llvm.vector.insert.v7i16.v2i16(<7 x i16> [[TMP17]], <2 x i16> [[TMP14]], i64 4)
; OPT-NEXT: [[TMP19:%.*]] = insertelement <7 x i16> [[TMP18]], i16 [[TMP15]], i64 6
; OPT-NEXT: store <7 x i16> [[TMP19]], ptr [[OUT:%.*]], align 1
; OPT-NEXT: ret void
;
; NOOPT-LABEL: @phi_v7i16_switch(
; NOOPT-NEXT: entry:
; NOOPT-NEXT: [[X:%.*]] = insertelement <7 x i16> [[IN:%.*]], i16 3, i32 3
; NOOPT-NEXT: switch i8 [[COND:%.*]], label [[ELSE:%.*]] [
; NOOPT-NEXT: i8 0, label [[THEN_1:%.*]]
; NOOPT-NEXT: i8 3, label [[THEN_2:%.*]]
; NOOPT-NEXT: ]
; NOOPT: then.1:
; NOOPT-NEXT: br label [[FINALLY:%.*]]
; NOOPT: then.2:
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: else:
; NOOPT-NEXT: [[Y:%.*]] = insertelement <7 x i16> [[IN]], i16 9, i32 6
; NOOPT-NEXT: br label [[FINALLY]]
; NOOPT: finally:
; NOOPT-NEXT: [[VAL:%.*]] = phi <7 x i16> [ [[X]], [[THEN_1]] ], [ [[X]], [[THEN_2]] ], [ [[Y]], [[ELSE]] ]
; NOOPT-NEXT: store <7 x i16> [[VAL]], ptr [[OUT:%.*]], align 1
; NOOPT-NEXT: ret void
;
entry:
%x = insertelement <7 x i16> %in, i16 3, i32 3
switch i8 %cond, label %else [
i8 0, label %then.1
i8 3, label %then.2
]
then.1:
br label %finally
then.2:
br label %finally
else:
%y = insertelement <7 x i16> %in, i16 9, i32 6
br label %finally
finally:
%val = phi <7 x i16> [%x, %then.1], [%x, %then.2], [%y, %else]
store <7 x i16> %val, ptr %out, align 1
ret void
}