[llvm] [BOLT] Fix local out-of-range stub issue that leads to infinite loop in LongJmp pass (PR #73918)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 01:36:51 PST 2023


linsinan1995 wrote:

> Thanks a lot for this fix, @linsinan1995. The only thing I would do differently is to add an assert that TgtSym is not null after line 208 "TgtSym = ....getTargetSymbol(*TgtBB->begin())", so we are not taken by surprise if we change the contents of a stub and all of a sudden the first instruction is not the branch anymore, in which case we will silently return nullptr to TgtSym and break LongJmp. There are a lot of assumptions in that line, which, admittedly, is part of the original code and not your code.

Added. Investigating bugs related to LongJmp is quite troublesome. Adding an assertion to prevent the continuation of the subsequent logic when TgtSym is null is indeed very helpful for debugging. Thanks for the suggestion.

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


More information about the llvm-commits mailing list