[llvm-branch-commits] [llvm] [MTE] add stack frame history buffer (PR #86356)
Florian Mayer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 20 15:53:03 PDT 2024
================
@@ -2497,7 +2497,8 @@ AArch64FrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI,
return resolveFrameIndexReference(
MF, FI, FrameReg,
/*PreferFP=*/
- MF.getFunction().hasFnAttribute(Attribute::SanitizeHWAddress),
+ MF.getFunction().hasFnAttribute(Attribute::SanitizeHWAddress) ||
+ MF.getFunction().hasFnAttribute(Attribute::SanitizeMemTag),
/*ForSimm=*/false);
----------------
fmayer wrote:
I compiled all of those tests with and without the `getFrameIndexReference` change, the assembly is the same
Without the `getFrameIndexReference` change:
```
for f in llvm/test/CodeGen/AArch64/stack-tagging-*; do build/bin/llc -mtriple=aarch64-linux-android10000 -mattr=+mte -stack-tagging-use-stack-safety=0 -stack-tagging-record-stack-history=instr $f -o tmp2/sp/$(basename $f).S; done
```
and with the `getFrameIndexReference` change:
```
for f in llvm/test/CodeGen/AArch64/stack-tagging-*; do build/bin/llc -mtriple=aarch64-linux-android10000 -mattr=+mte -stack-tagging-use-stack-safety=0 -stack-tagging-record-stack-history=instr $f -o tmp2/fp/$(basename $f).S; done
```
```
for f in fp/*; do diff -u $f sp/$(basename $f); done
```
comes back empty.
I also compiled a semi-randomly picked C++ file from AOSP [Unwinder.cpp](https://cs.android.com/android/platform/superproject/main/+/main:system/unwinding/libunwindstack/Unwinder.cpp?q=Unwinder.cpp&ss=android%2Fplatform%2Fsuperproject%2Fmain) which also compiles to the same Assembly.
https://github.com/llvm/llvm-project/pull/86356
More information about the llvm-branch-commits
mailing list