[llvm] [CFI] Fix Direct Call Issues in CFI Dispatch Table (PR #69663)
Oskar Wirga via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 9 07:04:48 PST 2023
================
@@ -1471,6 +1471,11 @@ void LowerTypeTestsModule::createJumpTable(
SmallVector<Value *, 16> AsmArgs;
AsmArgs.reserve(Functions.size() * 2);
+ // Check if the first entry has the NoUnwind attribute.
----------------
oskarwirga wrote:
I confirmed that with dispatch tables of size > 1 I do not see direct calls to the jump table for throwing functions:
```llvm
define dso_local void @_Z10call_catchi(i32 noundef %num) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 !type !4 !type !5 !type !6 {
entry:
store ptr getelementptr inbounds ([2 x [8 x i8]], ptr @_Z8no_throwi.cfi_jt, i64 0, i64 1), ptr @catch_ptr, align 8, !tbaa !14
invoke void getelementptr inbounds ([2 x [8 x i8]], ptr @_Z8no_throwi.cfi_jt, i64 0, i64 1)(i32 noundef %num) #8
to label %try.cont unwind label %lpad
lpad: ; preds = %entry
%0 = landingpad { ptr, i32 }
catch ptr @_ZTIi
%1 = extractvalue { ptr, i32 } %0, 1
%2 = tail call i32 @llvm.eh.typeid.for(ptr nonnull @_ZTIi) #10
%matches = icmp eq i32 %1, %2
br i1 %matches, label %catch, label %eh.resume
catch: ; preds = %lpad
%3 = extractvalue { ptr, i32 } %0, 0
%4 = tail call ptr @__cxa_begin_catch(ptr %3) #10
tail call void @__cxa_end_catch() #10
br label %try.cont
try.cont: ; preds = %catch, %entry
ret void
eh.resume: ; preds = %lpad
resume { ptr, i32 } %0
}
```
https://github.com/llvm/llvm-project/pull/69663
More information about the llvm-commits
mailing list