Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3351,14 +3351,15 @@ 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.
constexpr std::array<uint32_t, 7> kAllowedBundles = {
constexpr std::array<uint32_t, 8> 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};
LLVMContext::OB_clang_arc_attachedcall,
LLVMContext::OB_kcfi};
if (I.hasOperandBundlesOtherThan(kAllowedBundles)) {
std::string Error;
for (unsigned i = 0, e = I.getNumOperandBundles(); i != e; ++i) {
Expand Down
23 changes: 23 additions & 0 deletions llvm/test/CodeGen/X86/kcfi.ll
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,29 @@ define void @f8() {
ret void
}

declare i32 @__gxx_personality_v0(...)

define void @f9() personality ptr @__gxx_personality_v0 {
; MIR-LABEL: name: f9
; MIR: body:
; ISEL: CALL64m killed %0, 1, $noreg, 0, $noreg, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, cfi-type 12345678
; KCFI: $r11 = MOV64rm killed renamable $rax, 1, $noreg, 0, $noreg
; KCFI-NEXT: BUNDLE{{.*}} {
; KCFI-NEXT: KCFI_CHECK $r11, 12345678, implicit-def $r10, implicit-def $r11, implicit-def $eflags
; KCFI-NEXT: CALL64r internal $r11, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp
; KCFI-NEXT: }
%1 = load ptr, ptr @g, align 8
invoke void %1() [ "kcfi"(i32 12345678) ]
to label %cont
unwind label %err
cont:
ret void
err:
%exn = landingpad { i8*, i32 }
catch i8* null
resume { i8*, i32 } %exn
}

attributes #0 = { "target-features"="+retpoline-indirect-branches,+retpoline-indirect-calls" }

!llvm.module.flags = !{!0}
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.