[clang] [llvm] [RISCV] Mark {vl, vtype} as clobber in inline assembly (PR #128636)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 7 16:07:43 PST 2025
topperc wrote:
The RISCVInsertVSETVLI approach is probably just a matter of doing something like. May should check if an implicit def already exists before adding it. I don't think addOperand checks for duplicates.
```
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 7433603daff8..2247610c21ff 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -1531,6 +1531,13 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock &MBB) {
/*isImp*/ true));
}
+ if (MI.isInlineAsm()) {
+ MI.addOperand(MachineOperand::CreateReg(RISCV::VL, /*isDef*/ true,
+ /*isImp*/ true));
+ MI.addOperand(MachineOperand::CreateReg(RISCV::VTYPE, /*isDef*/ true,
+ /*isImp*/ true));
+ }
+
if (MI.isCall() || MI.isInlineAsm() ||
MI.modifiesRegister(RISCV::VL, /*TRI=*/nullptr) ||
MI.modifiesRegister(RISCV::VTYPE, /*TRI=*/nullptr))
```
https://github.com/llvm/llvm-project/pull/128636
More information about the cfe-commits
mailing list