mirror of
https://github.com/intel/llvm.git
synced 2026-01-12 18:27:07 +08:00
[SelectOptimize] Respect optnone (#170858)
Add the missing skipFunction() call so that optnone attributes and opt-bisect-limit is respected.
This commit is contained in:
@@ -313,6 +313,9 @@ public:
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F) override {
|
||||
if (skipFunction(F))
|
||||
return false;
|
||||
|
||||
return Impl.runOnFunction(F, *this);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,16 @@ define i32 @weighted_select1(i32 %a, i32 %b, i1 %cmp) {
|
||||
ret i32 %sel
|
||||
}
|
||||
|
||||
; But don't do anything for optnone functions.
|
||||
define i32 @weighted_select1_optnone(i32 %a, i32 %b, i1 %cmp) optnone noinline {
|
||||
; CHECK-LABEL: @weighted_select1_optnone(
|
||||
; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP:%.*]], i32 [[A:%.*]], i32 [[B:%.*]], !prof [[PROF16]]
|
||||
; CHECK-NEXT: ret i32 [[SEL]]
|
||||
;
|
||||
%sel = select i1 %cmp, i32 %a, i32 %b, !prof !15
|
||||
ret i32 %sel
|
||||
}
|
||||
|
||||
; If a select is obviously predictable (reversed profile weights),
|
||||
; turn it into a branch.
|
||||
define i32 @weighted_select2(i32 %a, i32 %b, i1 %cmp) {
|
||||
|
||||
Reference in New Issue
Block a user