Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp =================================================================== --- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3568,7 +3568,8 @@ 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 Index: llvm/test/Transforms/InstCombine/expensive-combines.ll =================================================================== --- llvm/test/Transforms/InstCombine/expensive-combines.ll +++ llvm/test/Transforms/InstCombine/expensive-combines.ll @@ -16,7 +16,7 @@ ; ; 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)