If alternate node has only 2 instructions and the tree is already big
enough, better to skip the vectorization of such nodes, they are not
very profitable (the resulting code cotains 3 instructions instead of
original 2 scalars). SLP can try to vectorize the buildvector sequence
in the next attempt, if it is profitable.
Metric: SLP.NumVectorInstructions
Program SLP.NumVectorInstructions
results results0 diff
test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C/miniAMR/miniAMR.test 72.00 73.00 1.4%
test-suite :: MultiSource/Benchmarks/Prolangs-C/TimberWolfMC/timberwolfmc.test 1186.00 1198.00 1.0%
test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/miniFE.test 241.00 242.00 0.4%
test-suite :: MultiSource/Applications/JM/lencod/lencod.test 2131.00 2139.00 0.4%
test-suite :: External/SPEC/CINT2017rate/523.xalancbmk_r/523.xalancbmk_r.test 6377.00 6384.00 0.1%
test-suite :: External/SPEC/CINT2017speed/623.xalancbmk_s/623.xalancbmk_s.test 6377.00 6384.00 0.1%
test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test 12650.00 12658.00 0.1%
test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 26169.00 26147.00 -0.1%
test-suite :: MultiSource/Benchmarks/Trimaran/enc-3des/enc-3des.test 99.00 86.00 -13.1%
Gains:
526.blender_r - more vectorized trees.
enc-3des - same.
Others:
510.parest_r - no changes.
miniFE - same
623.xalancbmk_s - some (non-profitable) parts of the trees are not
vectorized.
523.xalancbmk_r - same
lencod - same
timberwolfmc - same
miniAMR - same
Differential Revision: https://reviews.llvm.org/D125571
38 lines
1.8 KiB
LLVM
38 lines
1.8 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 < %s | FileCheck %s
|
|
|
|
define dso_local void @rftbsub(double* %a) local_unnamed_addr #0 {
|
|
; CHECK-LABEL: @rftbsub(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds double, double* [[A:%.*]], i64 2
|
|
; CHECK-NEXT: [[SUB22:%.*]] = fsub double undef, undef
|
|
; CHECK-NEXT: [[TMP0:%.*]] = bitcast double* [[ARRAYIDX6]] to <2 x double>*
|
|
; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, <2 x double>* [[TMP0]], align 8
|
|
; CHECK-NEXT: [[TMP2:%.*]] = extractelement <2 x double> [[TMP1]], i32 1
|
|
; CHECK-NEXT: [[ADD16:%.*]] = fadd double [[TMP2]], undef
|
|
; CHECK-NEXT: [[MUL18:%.*]] = fmul double undef, [[ADD16]]
|
|
; CHECK-NEXT: [[ADD19:%.*]] = fadd double undef, [[MUL18]]
|
|
; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x double> poison, double [[ADD19]], i32 0
|
|
; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x double> [[TMP3]], double [[SUB22]], i32 1
|
|
; CHECK-NEXT: [[TMP5:%.*]] = fsub <2 x double> [[TMP1]], [[TMP4]]
|
|
; CHECK-NEXT: [[TMP6:%.*]] = bitcast double* [[ARRAYIDX6]] to <2 x double>*
|
|
; CHECK-NEXT: store <2 x double> [[TMP5]], <2 x double>* [[TMP6]], align 8
|
|
; CHECK-NEXT: unreachable
|
|
;
|
|
entry:
|
|
%arrayidx6 = getelementptr inbounds double, double* %a, i64 2
|
|
%0 = load double, double* %arrayidx6, align 8
|
|
%1 = or i64 2, 1
|
|
%arrayidx12 = getelementptr inbounds double, double* %a, i64 %1
|
|
%2 = load double, double* %arrayidx12, align 8
|
|
%add16 = fadd double %2, undef
|
|
%mul18 = fmul double undef, %add16
|
|
%add19 = fadd double undef, %mul18
|
|
%sub22 = fsub double undef, undef
|
|
%sub25 = fsub double %0, %add19
|
|
store double %sub25, double* %arrayidx6, align 8
|
|
%sub29 = fsub double %2, %sub22
|
|
store double %sub29, double* %arrayidx12, align 8
|
|
unreachable
|
|
}
|