File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -443,7 +443,7 @@ bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
443
443
TM.resetTargetOptions (Fn);
444
444
// Reset OptLevel to None for optnone functions.
445
445
CodeGenOpt::Level NewOptLevel = OptLevel;
446
- if (Fn. hasFnAttribute (Attribute::OptimizeNone ))
446
+ if (OptLevel != CodeGenOpt::None && skipFunction (Fn ))
447
447
NewOptLevel = CodeGenOpt::None;
448
448
OptLevelChanger OLC (*this , NewOptLevel);
449
449
Original file line number Diff line number Diff line change
1
+ ; This test verifies that no optimizations are performed on the @f function
2
+ ; when the -opt-bisect-limit=0 option is used. In particular, the X86
3
+ ; instruction selector will optimize the cmp instruction to a sub instruction
4
+ ; if it is not run in -O0 mode.
5
+
6
+ ; RUN: llc -O3 -opt-bisect-limit=0 -o - %s | FileCheck %s
7
+
8
+ target triple = "x86_64-unknown-linux-gnu"
9
+
10
+ define void @f () {
11
+ entry:
12
+ %cmp = icmp slt i32 undef , 8
13
+ br i1 %cmp , label %middle , label %end
14
+
15
+ middle:
16
+ br label %end
17
+
18
+ end:
19
+ ret void
20
+ }
21
+
22
+ ; CHECK: cmpl $8, %eax
You can’t perform that action at this time.
0 commit comments