[all-commits] [llvm/llvm-project] 33b963: [ARM] v6-M XO: save CPSR around LoadStackGuard
simonwallis2 via All-commits
all-commits at lists.llvm.org
Wed Aug 9 00:41:15 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 33b9634394de673fce8a60281979df8328687a81
https://github.com/llvm/llvm-project/commit/33b9634394de673fce8a60281979df8328687a81
Author: Simon Wallis <simon.wallis2 at arm.com>
Date: 2023-08-09 (Wed, 09 Aug 2023)
Changed paths:
M llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
M llvm/test/CodeGen/Thumb/stack-guard-xo.ll
Log Message:
-----------
[ARM] v6-M XO: save CPSR around LoadStackGuard
For Thumb-1 Execute-Only, expandLoadStackGuardBase generates a tMOVimm32 pseudo when calculating the stack offset.
It does this in a context where the CSPR maybe be live. tMOVimm32 may corrupt CPSR.
To fix this, generate save/restore CPSR around the tMOVimm32 using MRS/MSR to/from a scratch register.
expandLoadStackGuardBase this runs after register allocation, so the scratch register needs to be a physical register.
Use R12 as a scratch register, as is usual when expanding a pseudo.
MSR/MRS are some of the few v6-M instructions which operate on a high register.
New stack-guard test case added which was generating incorrect code without the save/restore CPSR.
Reviewed By: stuij
Differential Revision: https://reviews.llvm.org/D156968
More information about the All-commits
mailing list