-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[SelectionDAG] improve error message for invalid op bundles #148722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SelectionDAG] improve error message for invalid op bundles #148722
Conversation
Created using spr 1.3.4
|
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-llvm-selectiondag Author: Florian Mayer (fmayer) ChangesFull diff: https://github.com/llvm/llvm-project/pull/148722.diff 2 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index ecd1ff87e7fbc..3a6fd6283daed 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -3351,13 +3351,29 @@ void SelectionDAGBuilder::visitInvoke(const InvokeInst &I) {
// Deopt and ptrauth bundles are lowered in helper functions, and we don't
// have to do anything here to lower funclet bundles.
- if (I.hasOperandBundlesOtherThan(
- {LLVMContext::OB_deopt, LLVMContext::OB_gc_transition,
- LLVMContext::OB_gc_live, LLVMContext::OB_funclet,
- LLVMContext::OB_cfguardtarget, LLVMContext::OB_ptrauth,
- LLVMContext::OB_clang_arc_attachedcall}))
+ constexpr std::array<uint32_t, 7> kAllowedBundles = {
+ LLVMContext::OB_deopt,
+ LLVMContext::OB_gc_transition,
+ LLVMContext::OB_gc_live,
+ LLVMContext::OB_funclet,
+ LLVMContext::OB_cfguardtarget,
+ LLVMContext::OB_ptrauth,
+ LLVMContext::OB_clang_arc_attachedcall};
+ if (I.hasOperandBundlesOtherThan(kAllowedBundles)) {
+ std::string Error;
+ for (unsigned i = 0, e = I.getNumOperandBundles(); i != e; ++i) {
+ OperandBundleUse U = I.getOperandBundleAt(i);
+ bool First = true;
+ if (is_contained(kAllowedBundles, U.getTagID()))
+ continue;
+ if (!First)
+ Error += ", ";
+ First = false;
+ Error += U.getTagName();
+ }
reportFatalUsageError(
- "cannot lower invokes with arbitrary operand bundles!");
+ Twine("cannot lower invokes with arbitrary operand bundles: ", Error));
+ }
const Value *Callee(I.getCalledOperand());
const Function *Fn = dyn_cast<Function>(Callee);
diff --git a/llvm/test/CodeGen/X86/invalid-operand-bundle-invoke.ll b/llvm/test/CodeGen/X86/invalid-operand-bundle-invoke.ll
index 8091a220a44c5..1da41aeab68b9 100644
--- a/llvm/test/CodeGen/X86/invalid-operand-bundle-invoke.ll
+++ b/llvm/test/CodeGen/X86/invalid-operand-bundle-invoke.ll
@@ -1,6 +1,6 @@
; RUN: not llc -mtriple=x86_64-unknown-linux-gnu < %s 2>&1 | FileCheck %s
-; CHECK: LLVM ERROR: cannot lower invokes with arbitrary operand bundles!
+; CHECK: LLVM ERROR: cannot lower invokes with arbitrary operand bundles: foo
declare void @g()
declare i32 @__gxx_personality_v0(...)
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/23358 Here is the relevant piece of the build log for the reference |
| reportFatalUsageError( | ||
| "cannot lower invokes with arbitrary operand bundles!"); | ||
| Twine("cannot lower invokes with arbitrary operand bundles: ", Error)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This updated one of three places emitting this error. Please extract this into a helper function and use it in all three places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: #148945
| LLVMContext::OB_gc_live, LLVMContext::OB_funclet, | ||
| LLVMContext::OB_cfguardtarget, LLVMContext::OB_ptrauth, | ||
| LLVMContext::OB_clang_arc_attachedcall, LLVMContext::OB_kcfi})) | ||
| constexpr uint32_t kAllowedBundles[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LLVM does not use hungarian notation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in #148945
No description provided.