fix minsize detection: minsize attribute implies optimizing for size
authorSanjay Patel <spatel@rotateright.com>
Mon, 10 Aug 2015 20:45:44 +0000 (20:45 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 10 Aug 2015 20:45:44 +0000 (20:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244499 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp
test/CodeGen/X86/sse_partial_update.ll

index c37f5c8f087920cc37e58ff21d29d919b53563c5..d65c2d737643e193f20110ff2681584185bbe090 100644 (file)
@@ -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.
index 8bc44e270ef753dcecb33073aa5cfeef851283aa..8d61428420f6526b0743a2aa79458930777151b2 100644 (file)
@@ -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> <double 0x0, double 0x0>, <4 x float> %ld)