diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -440,7 +440,7 @@ // Speculative execution if the target has divergent branches; otherwise nop. if (Level.getSpeedupLevel() > 1) { - FPM.addPass(SpeculativeExecutionPass()); + FPM.addPass(SpeculativeExecutionPass(/*OnlyIfDivergentTarget=*/true)); // Optimize based on known information about branches, and cleanup afterward. FPM.addPass(JumpThreadingPass());