[llvm] [RISCV] Move RISCVInsertVSETVLI to after phi elimination (PR #91440)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 10:46:14 PDT 2024
================
@@ -541,9 +541,16 @@ void RISCVPassConfig::addPreRegAlloc() {
addPass(createRISCVPreRAExpandPseudoPass());
if (TM->getOptLevel() != CodeGenOptLevel::None)
addPass(createRISCVMergeBaseOffsetOptPass());
+
addPass(createRISCVInsertReadWriteCSRPass());
addPass(createRISCVInsertWriteVXRMPass());
- addPass(createRISCVInsertVSETVLIPass());
+
+ // Run RISCVInsertVSETVLI after PHI elimination. On O1 and above do it after
+ // register coalescing so needVSETVLIPHI doesn't need to look through COPYs.
+ if (TM->getOptLevel() == CodeGenOptLevel::None)
+ insertPass(&PHIEliminationID, createRISCVInsertVSETVLIPass());
----------------
lukel97 wrote:
Thanks for catching this, I can reproduce this locally and your explanation makes sense.
I would presume all the addX hooks are called up front regardless of where the cut off point is.
One possible fix is if we're deleting a pass because we've reached the cut off point, we could delete any other passes in InsertedPass that are waiting on it? Will try and prepare a patch for that.
https://github.com/llvm/llvm-project/pull/91440
More information about the llvm-commits
mailing list