aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorHuan Nguyen <nhuhuan@yahoo.com>2022-06-17 16:17:22 -0700
committerAmir Ayupov <aaupov@fb.com>2022-06-17 16:22:30 -0700
commit28b1dcb12280c3527c350352fb156347defc7092 (patch)
treedce425368dc825835fdc070f1439c6ec818ad1d1 /clang/lib/CodeGen/ModuleBuilder.cpp
parente5e7e5147322d4cbfd0c8309893c2273c3ee41ac (diff)
downloadllvm-28b1dcb12280c3527c350352fb156347defc7092.zip
llvm-28b1dcb12280c3527c350352fb156347defc7092.tar.gz
llvm-28b1dcb12280c3527c350352fb156347defc7092.tar.bz2
[BOLT] Allow function fragments to point to one jump table
Resolve a crash related to split functions Due to split function optimization, a function can be divided to two 
fragments, and both fragments can access same jump table. This violates 
the assumption that a jump table can only have one parent function, 
which causes a crash during instrumentation. We want to support the case: different functions cannot access same jump tables, but different fragments of same function can! As all fragments are from same function, we point JT::Parent to one specific fragment. Right now it is the first disassembled fragment, but we can point it to the function's main fragment later. Functions are disassembled sequentially. Previously, at the end of processing a function, JT::OffsetEntries is cleared, so other fragment can no longer reuse JT::OffsetEntries. To extend the support for split function, we only clear JT::OffsetEntries after all functions are disassembled. Let say A.hot and A.cold access JT of three targets {X, Y, Z}, where X and Y are in A.hot, and Z is in A.cold. Suppose that A.hot is disassembled first, JT::OffsetEntries = {X',Y',INVALID_OFFSET}. When A.cold is disassembled, it cannot reuse JT::OffsetEntries above due to different fragment start. A simple solution: A.hot = {X',Y',INVALID_OFFSET} A.cold = {INVALID_OFFSET, INVALID_OFFSET, INVALID_OFFSET} We update the assertion to allow different fragments of same function to get the same JumpTable object. Potential improvements: A.hot = {X',Y',INVALID_OFFSET} A.cold = {INVALID_OFFSET, INVALID_OFFSET, Z'} The main issue is A.hot and A.cold have separate CFGs, thus jump table targets are still constrained within fragment bounds. Future improvements: A.hot = {X, Y, Z} A.cold = {X, Y, Z} Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D127924
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
0 files changed, 0 insertions, 0 deletions