[llvm] [GlobalISel] Diagnose inline assembly constraint lowering errors (PR #135782)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 05:51:11 PDT 2025


================
@@ -231,6 +232,16 @@ bool InlineAsmLowering::lowerInlineAsm(
   TargetLowering::AsmOperandInfoVector TargetConstraints =
       TLI->ParseConstraints(DL, TRI, Call);
 
+  const auto ConstraintError = [&](const GISelAsmOperandInfo &Info, Twine Msg) {
+    LLVMContext &Ctx = MIRBuilder.getContext();
+    Ctx.diagnose(DiagnosticInfoInlineAsm(
+        Call, "invalid constraint '" + Info.ConstraintCode + "' in '" +
+                  MF.getName() + "': " + Msg));
----------------
arsenm wrote:

Avoid using getName, it's broken for anonymous functions. The context should be reported by the caller based on the context instructions, you shouldn't need to include it here 

https://github.com/llvm/llvm-project/pull/135782


More information about the llvm-commits mailing list