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
This commit is contained in:
Sanjay Patel 2015-08-11 14:31:14 +00:00
parent 0c91ac75d1
commit b15598e99a
2 changed files with 6 additions and 7 deletions

View 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()) {

View 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