When address sanitizing a function, stack unpinsoning code is inserted before each ret instruction. However if the ret instruciton is preceded by a musttail call, such transformation broke the musttail call contract and generates invalid IR.
This patch fixes the issue by moving the insertion point prior to the musttail call if there is one.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM except a minor comment.
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | ||
---|---|---|
562 | Is there a better place for this helper and avoid duplication? We have a few copies of it now, TSAN, ASAN and EntryExitInstrumenter... |
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | ||
---|---|---|
562 | Yeah I have been wondering about this too. There are more duplicates than TSAN and ASAN. |
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | ||
---|---|---|
562 | Was thinking about something like building this into SetInsertPoint of IRBuilder, perhaps with an extra boolean argument with default value. But doesn't look like good layering there - might be too specific for IRBuilder. I'm fine with the way it is now. |
Is there a better place for this helper and avoid duplication? We have a few copies of it now, TSAN, ASAN and EntryExitInstrumenter...