[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 16 13:28:23 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:

> Ideally, we would skip emitting EH info for all jump tables functions; even if the callee unwinds, the jump table isn't on the stack at that point anyway. Maybe worth adding some way to represent that.

IIUC we'd be able to differentiate NoUnwind from "don't emit EH info" for cfi jump table functions? 

> re: checking only the first entry, please consider the semantics in general, not just the specific optimizations which exist at the moment. Even if we don't optimize tables with multiple entries at the moment, someone could try to implement such an optimization in the future.

I appreciate this, I think its better to be safe in this instance. I will update the patch to instead check if all functions are marked NoUnwind. 

https://github.com/llvm/llvm-project/pull/69663


More information about the llvm-commits mailing list