aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGen.cpp
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2024-10-23 09:06:12 +0100
committerGitHub <noreply@github.com>2024-10-23 09:06:12 +0100
commitdd76d9b1bbe0a4ca5375604bc941bb422de55ed6 (patch)
treedf6106d77266fe1367b02f2c38eecf293ce1754a /llvm/lib/CodeGen/CodeGen.cpp
parentc6931c25255c913c5f0a650440b6150dd574f984 (diff)
downloadllvm-dd76d9b1bbe0a4ca5375604bc941bb422de55ed6.zip
llvm-dd76d9b1bbe0a4ca5375604bc941bb422de55ed6.tar.gz
llvm-dd76d9b1bbe0a4ca5375604bc941bb422de55ed6.tar.bz2
[llvm][ARM] Correct the properties of trap instructions (#113287)
Fixes #113154 The encodings used for llvm.trap() on ARM were all marked as barriers and terminators. This lead to stack frame destroy code being inserted before the trap if the trap was the last thing in the function and it had no return statement. ``` void fn() { volatile int i = 0; __builtin_trap(); } ``` Produced: ``` fn: push {r11, lr} << stack frame create <...> mov sp, r11 pop {r11, lr} << stack frame destroy .inst 0xe7ffdefe << trap bx lr ``` All the other targets don't mark them this way, instead they mark them with isTrap. I've changed ARM to do this, which fixes the code generation: ``` fn: push {r11, lr} << stack frame create <...> .inst 0xe7ffdefe << trap mov sp, r11 pop {r11, lr} << stack frame destroy bx lr ``` I've updated the existing trap test to force the need for a stack frame, then check that the instruction immediately after the trap is resetting the stack pointer. debugtrap was already working but I've added the same checks for it anyway.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGen.cpp')
0 files changed, 0 insertions, 0 deletions