summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorFlorian Mayer <fmayer@google.com>2025-07-14 15:12:01 -0700
committerFlorian Mayer <fmayer@google.com>2025-07-14 15:12:01 -0700
commiteb39f2414e4cb4b9ada7998df3f73969141ccff4 (patch)
treec5bb32b0ee864c53b39ede9bc8e484913520ca42 /llvm/lib/CodeGen
parent102c15ad28d3c312ea8926c85dbf907ca0d07b84 (diff)
[𝘀𝗽𝗿] changes to main this commit is based onusers/fmayer/spr/main.selectiondag-allow-kcfi-on-invoke
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index ecd1ff87e7fb..3a6fd6283dae 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);