From ef2e7b4819ed00e9da15f0e875b25125d7bba6cc Mon Sep 17 00:00:00 2001 From: Marcin Koscielnicki Date: Tue, 19 Apr 2016 23:46:59 +0000 Subject: [PATCH] [Mips] [MSan] VarArgMIPS64Helper: Use target's endian, not host's. Ugh. Differential Revision: http://reviews.llvm.org/D19292 llvm-svn: 266833 --- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 0edf186..40bd576 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -2965,15 +2965,16 @@ struct VarArgMIPS64Helper : public VarArgHelper { const DataLayout &DL = F.getParent()->getDataLayout(); for (CallSite::arg_iterator ArgIt = CS.arg_begin() + 1, End = CS.arg_end(); ArgIt != End; ++ArgIt) { + llvm::Triple TargetTriple(F.getParent()->getTargetTriple()); Value *A = *ArgIt; Value *Base; uint64_t ArgSize = DL.getTypeAllocSize(A->getType()); -#if defined(__MIPSEB__) || defined(MIPSEB) - // Adjusting the shadow for argument with size < 8 to match the placement - // of bits in big endian system - if (ArgSize < 8) - VAArgOffset += (8 - ArgSize); -#endif + if (TargetTriple.getArch() == llvm::Triple::mips64) { + // Adjusting the shadow for argument with size < 8 to match the placement + // of bits in big endian system + if (ArgSize < 8) + VAArgOffset += (8 - ArgSize); + } Base = getShadowPtrForVAArgument(A->getType(), IRB, VAArgOffset); VAArgOffset += ArgSize; VAArgOffset = alignTo(VAArgOffset, 8); -- 2.7.4