1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[InstCombine] Support disabling expensive combines in opt

Currently, there is no way to disable ExpensiveCombines when doing
a standalone opt -instcombine run, as that's the default, and the
opt option can currently only be used to force enable, not to force
disable. The only way to disable expensive combines is via -O1 or -O2,
but that of course also runs the rest of the kitchen sink...

This patch allows using opt -instcombine -expensive-combines=0 to
run InstCombine without ExpensiveCombines.

Differential Revision: https://reviews.llvm.org/D72861
This commit is contained in:
Nikita Popov 2020-01-16 21:03:09 +01:00
parent 7845296f1b
commit 963471fb57
2 changed files with 3 additions and 2 deletions

View File

@ -3568,7 +3568,8 @@ static bool combineInstructionsOverFunction(
ProfileSummaryInfo *PSI, bool ExpensiveCombines, unsigned MaxIterations,
LoopInfo *LI) {
auto &DL = F.getParent()->getDataLayout();
ExpensiveCombines |= EnableExpensiveCombines;
if (EnableExpensiveCombines.getNumOccurrences())
ExpensiveCombines = EnableExpensiveCombines;
MaxIterations = std::min(MaxIterations, LimitMaxIterations.getValue());
/// Builder - This is an IRBuilder that automatically inserts new

View File

@ -16,7 +16,7 @@ define void @test() {
;
; EXPENSIVE-OFF-LABEL: @test(
; EXPENSIVE-OFF-NEXT: [[CALL:%.*]] = call i32 @passthru(i32 0)
; EXPENSIVE-OFF-NEXT: call void @sink(i32 0)
; EXPENSIVE-OFF-NEXT: call void @sink(i32 [[CALL]])
; EXPENSIVE-OFF-NEXT: ret void
;
%call = call i32 @passthru(i32 0)