fix minsize detection: minsize attribute implies optimizing for size
authorSanjay Patel <spatel@rotateright.com>
Tue, 11 Aug 2015 14:31:14 +0000 (14:31 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 11 Aug 2015 14:31:14 +0000 (14:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244604 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineCombiner.cpp
test/CodeGen/AArch64/mul-lohi.ll

index aab436f4a5a63c6484f84842fd68bafb40180cf6..3a20d15880f29250c6d909c3ed0e9597fb76a15d 100644 (file)
@@ -426,9 +426,7 @@ bool MachineCombiner::runOnMachineFunction(MachineFunction &MF) {
   MRI = &MF.getRegInfo();
   Traces = &getAnalysis<MachineTraceMetrics>();
   MinInstr = 0;
-
-  // FIXME: Use Function::optForSize().
-  OptSize = MF.getFunction()->hasFnAttribute(Attribute::OptimizeForSize);
+  OptSize = MF.getFunction()->optForSize();
 
   DEBUG(dbgs() << getPassName() << ": " << MF.getName() << '\n');
   if (!TII->useMachineCombiner()) {
index 647594f41de4e6aa2ad3a0baa372533df3d3d12c..7237af28261903383d44772fcdd5c7d873b88919 100644 (file)
@@ -37,10 +37,11 @@ define i128 @test_128bitmul_optsize(i128 %lhs, i128 %rhs) optsize {
 
 define i128 @test_128bitmul_minsize(i128 %lhs, i128 %rhs) minsize {
 ; CHECK-LABEL: test_128bitmul_minsize:
-; CHECK-DAG: mul [[PART1:x[0-9]+]], x0, x3
-; CHECK-DAG: umulh [[CARRY:x[0-9]+]], x0, x2
-; CHECK: mul [[PART2:x[0-9]+]], x1, x2
-; CHECK: mul x0, x0, x2
+; CHECK:       umulh [[HI:x[0-9]+]], x0, x2
+; CHECK-NEXT:  madd  [[TEMP1:x[0-9]+]], x0, x3, [[HI]]
+; CHECK-NEXT:  madd  x1, x1, x2, [[TEMP1]]
+; CHECK-NEXT:  mul   x0, x0, x2
+; CHECK-NEXT:  ret
 
   %prod = mul i128 %lhs, %rhs
   ret i128 %prod