[llvm] [MSan] Separated PPC32 va_arg helper from PPC64 (PR #131827)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 09:50:58 PDT 2025
================
@@ -6551,42 +6541,27 @@ struct VarArgPowerPC32Helper : public VarArgHelperBase {
Value *VAArgSize = nullptr;
VarArgPowerPC32Helper(Function &F, MemorySanitizer &MS,
- MemorySanitizerVisitor &MSV, unsigned VAListTagSize)
- : VarArgHelperBase(F, MS, MSV, VAListTagSize) {}
+ MemorySanitizerVisitor &MSV)
+ : VarArgHelperBase(F, MS, MSV, /*VAListTagSize=*/12) {}
void visitCallBase(CallBase &CB, IRBuilder<> &IRB) override {
- // For PowerPC, we need to deal with alignment of stack arguments -
- // they are mostly aligned to 8 bytes, but vectors and i128 arrays
- // are aligned to 16 bytes, byvals can be aligned to 8 or 16 bytes,
- // For that reason, we compute current offset from stack pointer (which is
- // always properly aligned), and offset for the first vararg, then subtract
- // them.
unsigned VAArgBase;
Triple TargetTriple(F.getParent()->getTargetTriple());
- // Parameter save area starts at 48 bytes from frame pointer for ABIv1,
- // and 32 bytes for ABIv2. This is usually determined by target
- // endianness, but in theory could be overridden by function attribute.
- if (TargetTriple.isPPC64()) {
- if (TargetTriple.isPPC64ELFv2ABI())
- VAArgBase = 32;
- else
- VAArgBase = 48;
- } else {
- // Parameter save area is 8 bytes from frame pointer in PPC32
- VAArgBase = 8;
- }
+ // Parameter save area is 8 bytes from frame pointer in PPC32
+ VAArgBase = 8;
unsigned VAArgOffset = VAArgBase;
const DataLayout &DL = F.getDataLayout();
+ unsigned IntptrSize = DL.getTypeStoreSize(MS.IntptrTy);
----------------
vitalybuka wrote:
maybe assert(IntptrSize == 4) ?
https://github.com/llvm/llvm-project/pull/131827
More information about the llvm-commits
mailing list