mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-02 00:16:25 +00:00
fix minsize detection: minsize attribute implies optimizing for size
Also, add a test for optsize because this was not part of any existing regression test. llvm-svn: 244651
This commit is contained in:
parent
41c8aefa76
commit
b7a56def6f
@ -214,8 +214,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
|
||||
TLI = TM->getSubtargetImpl(F)->getTargetLowering();
|
||||
TLInfo = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||
TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
|
||||
// FIXME: Use Function::optForSize().
|
||||
OptSize = F.hasFnAttribute(Attribute::OptimizeForSize);
|
||||
OptSize = F.optForSize();
|
||||
|
||||
/// This optimization identifies DIV instructions that can be
|
||||
/// profitably bypassed and carried out with a shorter, faster divide.
|
||||
|
@ -25,4 +25,19 @@ entry:
|
||||
ret i64 %div
|
||||
}
|
||||
|
||||
; Verify that no extra code is generated when optimizing for size.
|
||||
|
||||
define i32 @div32_optsize(i32 %a, i32 %b) optsize {
|
||||
; DIV32-LABEL: div32_optsize:
|
||||
; DIV32-NOT: divb
|
||||
%div = sdiv i32 %a, %b
|
||||
ret i32 %div
|
||||
}
|
||||
|
||||
define i32 @div32_minsize(i32 %a, i32 %b) minsize {
|
||||
; DIV32-LABEL: div32_minsize:
|
||||
; DIV32-NOT: divb
|
||||
%div = sdiv i32 %a, %b
|
||||
ret i32 %div
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user