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

lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/x86-64-double-shifts-Oz-Os-O2.ll

index b6f34bd3a18f26aa09057243a0a842df4d835f7c..6dd4fb8d98eec40dc3e52eb6070b6b6f110f76de 100644 (file)
@@ -24127,10 +24127,7 @@ static SDValue PerformOrCombine(SDNode *N, SelectionDAG &DAG,
     return SDValue();
 
   // fold (or (x << c) | (y >> (64 - c))) ==> (shld64 x, y, c)
-  MachineFunction &MF = DAG.getMachineFunction();
-  // FIXME: Use Function::optForSize().
-  bool OptForSize =
-      MF.getFunction()->hasFnAttribute(Attribute::OptimizeForSize);
+  bool OptForSize = DAG.getMachineFunction().getFunction()->optForSize();
 
   // SHLD/SHRD instructions have lower register pressure, but on some
   // platforms they have higher latency than the equivalent
index 08d0257a0e5ceec220bf95bdb569c309b0105e9e..ba559aa2ff0eb868122c35ed8d83a3a778919ce8 100644 (file)
@@ -9,7 +9,7 @@
 ;     return (a << 10) | (b >> 54);
 ; }
 
-; Function Attrs: minsize nounwind optsize readnone uwtable
+; Function Attrs: minsize nounwind readnone uwtable
 define i64 @_Z8lshift10mm(i64 %a, i64 %b) #0 {
 entry:
 ; CHECK:   shldq   $10
@@ -19,7 +19,7 @@ entry:
   ret i64 %or
 }
 
-attributes #0 = { minsize nounwind optsize readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #0 = { minsize nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
 
 
 ; clang -Os -c test2.cpp -emit-llvm -S