From b718a987d0ecc0442676c98c6bc3f157bef13f3e Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 10 Aug 2015 20:45:44 +0000 Subject: [PATCH] fix minsize detection: minsize attribute implies optimizing for size git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244499 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrInfo.cpp | 7 ++----- test/CodeGen/X86/sse_partial_update.ll | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index c37f5c8f087..d65c2d73764 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -5347,11 +5347,8 @@ MachineInstr *X86InstrInfo::foldMemoryOperandImpl( // Check switch flag if (NoFusing) return nullptr; - // Unless optimizing for size, don't fold to avoid partial - // register update stalls - // FIXME: Use Function::optForSize(). - if (!MF.getFunction()->hasFnAttribute(Attribute::OptimizeForSize) && - hasPartialRegUpdate(MI->getOpcode())) + // Avoid partial register update stalls unless optimizing for size. + if (!MF.getFunction()->optForSize() && hasPartialRegUpdate(MI->getOpcode())) return nullptr; // Determine the alignment of the load. diff --git a/test/CodeGen/X86/sse_partial_update.ll b/test/CodeGen/X86/sse_partial_update.ll index 8bc44e270ef..8d61428420f 100644 --- a/test/CodeGen/X86/sse_partial_update.ll +++ b/test/CodeGen/X86/sse_partial_update.ll @@ -113,9 +113,8 @@ define <2 x double> @load_fold_cvtss2sd_int_optsize(<4 x float> *%a) optsize { define <2 x double> @load_fold_cvtss2sd_int_minsize(<4 x float> *%a) minsize { ; CHECK-LABEL: load_fold_cvtss2sd_int_minsize: -; CHECK: movaps (%rdi), %xmm1 -; CHECK-NEXT: xorps %xmm0, %xmm0 -; CHECK-NEXT: cvtss2sd %xmm1, %xmm0 +; CHECK: xorps %xmm0, %xmm0 +; CHECK-NEXT: cvtss2sd (%rdi), %xmm0 ; CHECK-NEXT: retq %ld = load <4 x float>, <4 x float> *%a %x = call <2 x double> @llvm.x86.sse2.cvtss2sd(<2 x double> , <4 x float> %ld) -- 2.34.1