diff options
author | Florian Mayer <fmayer@google.com> | 2025-07-14 15:12:01 -0700 |
---|---|---|
committer | Florian Mayer <fmayer@google.com> | 2025-07-14 15:12:01 -0700 |
commit | eb39f2414e4cb4b9ada7998df3f73969141ccff4 (patch) | |
tree | c5bb32b0ee864c53b39ede9bc8e484913520ca42 | |
parent | 102c15ad28d3c312ea8926c85dbf907ca0d07b84 (diff) | |
download | llvm-users/fmayer/spr/main.selectiondag-allow-kcfi-on-invoke.zip llvm-users/fmayer/spr/main.selectiondag-allow-kcfi-on-invoke.tar.gz llvm-users/fmayer/spr/main.selectiondag-allow-kcfi-on-invoke.tar.bz2 |
[𝘀𝗽𝗿] changes to main this commit is based onusers/fmayer/spr/main.selectiondag-allow-kcfi-on-invoke
Created using spr 1.3.4
[skip ci]
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 28 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/invalid-operand-bundle-invoke.ll | 2 |
2 files changed, 23 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index ecd1ff8..3a6fd62 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 8091a22..1da41ae 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(...) |