diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp --- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp @@ -183,5 +183,6 @@ } void RISCVPassConfig::addPreRegAlloc() { - addPass(createRISCVMergeBaseOffsetOptPass()); + if (TM->getOptLevel() != CodeGenOpt::None) + addPass(createRISCVMergeBaseOffsetOptPass()); }