[PATCH] D83332: [PGO][PGSO] Add profile guided size optimization to X86 ISel Lowering.
Hiroshi Yamauchi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 14:23:00 PDT 2020
yamauchi updated this revision to Diff 276556.
yamauchi added a comment.
Rebased on the split tests (D83424 <https://reviews.llvm.org/D83424>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83332/new/
https://reviews.llvm.org/D83332
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/avx-vperm2x128.ll
llvm/test/CodeGen/X86/phaddsub-extract.ll
Index: llvm/test/CodeGen/X86/phaddsub-extract.ll
===================================================================
--- llvm/test/CodeGen/X86/phaddsub-extract.ll
+++ llvm/test/CodeGen/X86/phaddsub-extract.ll
@@ -2095,35 +2095,19 @@
}
define i32 @hadd32_4_pgso(<4 x i32> %x225) !prof !14 {
-; SSE3-SLOW-LABEL: hadd32_4_pgso:
-; SSE3-SLOW: # %bb.0:
-; SSE3-SLOW-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; SSE3-SLOW-NEXT: paddd %xmm0, %xmm1
-; SSE3-SLOW-NEXT: phaddd %xmm1, %xmm1
-; SSE3-SLOW-NEXT: movd %xmm1, %eax
-; SSE3-SLOW-NEXT: retq
-;
-; SSE3-FAST-LABEL: hadd32_4_pgso:
-; SSE3-FAST: # %bb.0:
-; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
-; SSE3-FAST-NEXT: phaddd %xmm0, %xmm0
-; SSE3-FAST-NEXT: movd %xmm0, %eax
-; SSE3-FAST-NEXT: retq
-;
-; AVX-SLOW-LABEL: hadd32_4_pgso:
-; AVX-SLOW: # %bb.0:
-; AVX-SLOW-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
-; AVX-SLOW-NEXT: vpaddd %xmm1, %xmm0, %xmm0
-; AVX-SLOW-NEXT: vphaddd %xmm0, %xmm0, %xmm0
-; AVX-SLOW-NEXT: vmovd %xmm0, %eax
-; AVX-SLOW-NEXT: retq
+; SSE3-LABEL: hadd32_4_pgso:
+; SSE3: # %bb.0:
+; SSE3-NEXT: phaddd %xmm0, %xmm0
+; SSE3-NEXT: phaddd %xmm0, %xmm0
+; SSE3-NEXT: movd %xmm0, %eax
+; SSE3-NEXT: retq
;
-; AVX-FAST-LABEL: hadd32_4_pgso:
-; AVX-FAST: # %bb.0:
-; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
-; AVX-FAST-NEXT: vphaddd %xmm0, %xmm0, %xmm0
-; AVX-FAST-NEXT: vmovd %xmm0, %eax
-; AVX-FAST-NEXT: retq
+; AVX-LABEL: hadd32_4_pgso:
+; AVX: # %bb.0:
+; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
+; AVX-NEXT: vphaddd %xmm0, %xmm0, %xmm0
+; AVX-NEXT: vmovd %xmm0, %eax
+; AVX-NEXT: retq
%x226 = shufflevector <4 x i32> %x225, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
%x227 = add <4 x i32> %x225, %x226
%x228 = shufflevector <4 x i32> %x227, <4 x i32> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
Index: llvm/test/CodeGen/X86/avx-vperm2x128.ll
===================================================================
--- llvm/test/CodeGen/X86/avx-vperm2x128.ll
+++ llvm/test/CodeGen/X86/avx-vperm2x128.ll
@@ -397,8 +397,7 @@
define <4 x double> @shuffle_v4f64_zz23_pgso(<4 x double> %a) !prof !14 {
; ALL-LABEL: shuffle_v4f64_zz23_pgso:
; ALL: # %bb.0:
-; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
-; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
+; ALL-NEXT: vperm2f128 {{.*#+}} ymm0 = zero,zero,ymm0[2,3]
; ALL-NEXT: retq
%s = shufflevector <4 x double> %a, <4 x double> <double 0.0, double 0.0, double undef, double undef>, <4 x i32> <i32 4, i32 5, i32 2, i32 3>
ret <4 x double> %s
@@ -441,8 +440,7 @@
define <4 x double> @shuffle_v4f64_zz67_pgso(<4 x double> %a) !prof !14 {
; ALL-LABEL: shuffle_v4f64_zz67_pgso:
; ALL: # %bb.0:
-; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
-; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
+; ALL-NEXT: vperm2f128 {{.*#+}} ymm0 = zero,zero,ymm0[2,3]
; ALL-NEXT: retq
%s = shufflevector <4 x double> <double 0.0, double 0.0, double undef, double undef>, <4 x double> %a, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
ret <4 x double> %s
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -34445,7 +34445,7 @@
return DAG.getBitcast(RootVT, V1);
}
- bool OptForSize = DAG.getMachineFunction().getFunction().hasOptSize();
+ bool OptForSize = DAG.shouldOptForSize();
unsigned RootSizeInBits = RootVT.getSizeInBits();
unsigned NumRootElts = RootVT.getVectorNumElements();
unsigned BaseMaskEltSizeInBits = RootSizeInBits / NumBaseMaskElts;
@@ -39287,7 +39287,7 @@
}
// Only use (F)HADD opcodes if they aren't microcoded or minimizes codesize.
- bool OptForSize = DAG.getMachineFunction().getFunction().hasOptSize();
+ bool OptForSize = DAG.shouldOptForSize();
if (!Subtarget.hasFastHorizontalOps() && !OptForSize)
return SDValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83332.276556.patch
Type: text/x-patch
Size: 4060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200708/d36375a3/attachment-0001.bin>
More information about the llvm-commits
mailing list