Skip to content

Commit e9df48e

Browse files
committed
Revert "(reland) [GlobalISel] Diagnose inline assembly constraint lowering errors (#139049)"
This reverts commit 534d221.
1 parent 8fa3b52 commit e9df48e

File tree

2 files changed

+33
-71
lines changed

2 files changed

+33
-71
lines changed

llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "llvm/CodeGen/MachineOperand.h"
1717
#include "llvm/CodeGen/MachineRegisterInfo.h"
1818
#include "llvm/CodeGen/TargetLowering.h"
19-
#include "llvm/IR/DiagnosticInfo.h"
2019
#include "llvm/IR/Module.h"
2120

2221
#define DEBUG_TYPE "inline-asm-lowering"
@@ -232,19 +231,6 @@ bool InlineAsmLowering::lowerInlineAsm(
232231
TargetLowering::AsmOperandInfoVector TargetConstraints =
233232
TLI->ParseConstraints(DL, TRI, Call);
234233

235-
const auto ConstraintError = [&](const GISelAsmOperandInfo &Info, Twine Msg) {
236-
// Use warnings in combination with a "return false" to trigger the fallback
237-
// path. If fallback isn't enabled, then another error will be emitted later
238-
// and the warnings will provide context as to why the error occured.
239-
LLVMContext &Ctx = MIRBuilder.getContext();
240-
Ctx.diagnose(DiagnosticInfoInlineAsm(
241-
Call, "invalid constraint '" + Info.ConstraintCode + "': " + Msg,
242-
DS_Warning));
243-
// TODO: If we could detect that the fallback isn't enabled, we could
244-
// recover here by defining all result registers as G_IMPLICIT_DEF.
245-
return false;
246-
};
247-
248234
ExtraFlags ExtraInfo(Call);
249235
unsigned ArgNo = 0; // ArgNo - The argument of the CallInst.
250236
unsigned ResNo = 0; // ResNo - The result number of the next output.
@@ -257,8 +243,8 @@ bool InlineAsmLowering::lowerInlineAsm(
257243
OpInfo.CallOperandVal = const_cast<Value *>(Call.getArgOperand(ArgNo));
258244

259245
if (isa<BasicBlock>(OpInfo.CallOperandVal)) {
260-
return ConstraintError(OpInfo,
261-
"basic block input operands not supported yet");
246+
LLVM_DEBUG(dbgs() << "Basic block input operands not supported yet\n");
247+
return false;
262248
}
263249

264250
Type *OpTy = OpInfo.CallOperandVal->getType();
@@ -272,8 +258,9 @@ bool InlineAsmLowering::lowerInlineAsm(
272258

273259
// FIXME: Support aggregate input operands
274260
if (!OpTy->isSingleValueType()) {
275-
return ConstraintError(OpInfo,
276-
"aggregate input operands not supported yet");
261+
LLVM_DEBUG(
262+
dbgs() << "Aggregate input operands are not supported yet\n");
263+
return false;
277264
}
278265

279266
OpInfo.ConstraintVT =
@@ -357,8 +344,9 @@ bool InlineAsmLowering::lowerInlineAsm(
357344

358345
// Find a register that we can use.
359346
if (OpInfo.Regs.empty()) {
360-
return ConstraintError(
361-
OpInfo, "could not allocate output register for constraint");
347+
LLVM_DEBUG(dbgs()
348+
<< "Couldn't allocate output register for constraint\n");
349+
return false;
362350
}
363351

364352
// Add information to the INLINEASM instruction to know that this
@@ -401,13 +389,13 @@ bool InlineAsmLowering::lowerInlineAsm(
401389

402390
const InlineAsm::Flag MatchedOperandFlag(Inst->getOperand(InstFlagIdx).getImm());
403391
if (MatchedOperandFlag.isMemKind()) {
404-
return ConstraintError(
405-
OpInfo,
406-
"matching input constraint to mem operand not supported; this "
407-
"should be target specific");
392+
LLVM_DEBUG(dbgs() << "Matching input constraint to mem operand not "
393+
"supported. This should be target specific.\n");
394+
return false;
408395
}
409396
if (!MatchedOperandFlag.isRegDefKind() && !MatchedOperandFlag.isRegDefEarlyClobberKind()) {
410-
return ConstraintError(OpInfo, "unknown matching constraint");
397+
LLVM_DEBUG(dbgs() << "Unknown matching constraint\n");
398+
return false;
411399
}
412400

413401
// We want to tie input to register in next operand.
@@ -437,10 +425,9 @@ bool InlineAsmLowering::lowerInlineAsm(
437425

438426
if (OpInfo.ConstraintType == TargetLowering::C_Other &&
439427
OpInfo.isIndirect) {
440-
return ConstraintError(
441-
OpInfo,
442-
"indirect input operands with unknown constraint not supported "
443-
"yet");
428+
LLVM_DEBUG(dbgs() << "Indirect input operands with unknown constraint "
429+
"not supported yet\n");
430+
return false;
444431
}
445432

446433
if (OpInfo.ConstraintType == TargetLowering::C_Immediate ||
@@ -450,7 +437,9 @@ bool InlineAsmLowering::lowerInlineAsm(
450437
if (!lowerAsmOperandForConstraint(OpInfo.CallOperandVal,
451438
OpInfo.ConstraintCode, Ops,
452439
MIRBuilder)) {
453-
return ConstraintError(OpInfo, "unsupported constraint");
440+
LLVM_DEBUG(dbgs() << "Don't support constraint: "
441+
<< OpInfo.ConstraintCode << " yet\n");
442+
return false;
454443
}
455444

456445
assert(Ops.size() > 0 &&
@@ -467,8 +456,9 @@ bool InlineAsmLowering::lowerInlineAsm(
467456
if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
468457

469458
if (!OpInfo.isIndirect) {
470-
return ConstraintError(
471-
OpInfo, "indirect memory input operands are not supported yet");
459+
LLVM_DEBUG(dbgs()
460+
<< "Cannot indirectify memory input operands yet\n");
461+
return false;
472462
}
473463

474464
assert(OpInfo.isIndirect && "Operand must be indirect to be a mem!");
@@ -492,15 +482,18 @@ bool InlineAsmLowering::lowerInlineAsm(
492482
"Unknown constraint type!");
493483

494484
if (OpInfo.isIndirect) {
495-
return ConstraintError(
496-
OpInfo, "indirect register inputs are not supported yet");
485+
LLVM_DEBUG(dbgs() << "Can't handle indirect register inputs yet "
486+
"for constraint '"
487+
<< OpInfo.ConstraintCode << "'\n");
488+
return false;
497489
}
498490

499491
// Copy the input into the appropriate registers.
500492
if (OpInfo.Regs.empty()) {
501-
return ConstraintError(
502-
OpInfo,
503-
"could not allocate input register for register constraint");
493+
LLVM_DEBUG(
494+
dbgs()
495+
<< "Couldn't allocate input register for register constraint\n");
496+
return false;
504497
}
505498

506499
unsigned NumRegs = OpInfo.Regs.size();
@@ -510,10 +503,9 @@ bool InlineAsmLowering::lowerInlineAsm(
510503
"source registers");
511504

512505
if (NumRegs > 1) {
513-
return ConstraintError(
514-
OpInfo,
515-
"input operands with multiple input registers are not supported "
516-
"yet");
506+
LLVM_DEBUG(dbgs() << "Input operands with multiple input registers are "
507+
"not supported yet\n");
508+
return false;
517509
}
518510

519511
InlineAsm::Flag Flag(InlineAsm::Kind::RegUse, NumRegs);

llvm/test/CodeGen/AMDGPU/GlobalISel/inline-asm-lowering-diags.ll

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)