From b15598e99ae8975f8cae5396dfc02f71a8fffa9f Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Tue, 11 Aug 2015 14:31:14 +0000 Subject: [PATCH] fix minsize detection: minsize attribute implies optimizing for size git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244604 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineCombiner.cpp | 4 +--- test/CodeGen/AArch64/mul-lohi.ll | 9 +++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/CodeGen/MachineCombiner.cpp b/lib/CodeGen/MachineCombiner.cpp index aab436f4a5a..3a20d15880f 100644 --- a/lib/CodeGen/MachineCombiner.cpp +++ b/lib/CodeGen/MachineCombiner.cpp @@ -426,9 +426,7 @@ bool MachineCombiner::runOnMachineFunction(MachineFunction &MF) { MRI = &MF.getRegInfo(); Traces = &getAnalysis(); 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()) { diff --git a/test/CodeGen/AArch64/mul-lohi.ll b/test/CodeGen/AArch64/mul-lohi.ll index 647594f41de..7237af28261 100644 --- a/test/CodeGen/AArch64/mul-lohi.ll +++ b/test/CodeGen/AArch64/mul-lohi.ll @@ -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 -- 2.34.1