From a6c2ab0c3f66c20007bab6ca2c6a3a81e70f5d7a Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Mon, 13 Jun 2022 12:49:50 +0000 Subject: [PATCH] [NFC][Alignment] Use proper type in instrumentLoadOrStore --- llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 765baea4b80b..5cc5804dcbc5 100644 --- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -636,8 +636,8 @@ bool ThreadSanitizer::instrumentLoadOrStore(const InstructionInfo &II, return true; } - const unsigned Alignment = IsWrite ? cast(II.Inst)->getAlignment() - : cast(II.Inst)->getAlignment(); + const Align Alignment = IsWrite ? cast(II.Inst)->getAlign() + : cast(II.Inst)->getAlign(); const bool IsCompoundRW = ClCompoundReadBeforeWrite && (II.Flags & InstructionInfo::kCompoundRW); const bool IsVolatile = ClDistinguishVolatile && @@ -647,7 +647,7 @@ bool ThreadSanitizer::instrumentLoadOrStore(const InstructionInfo &II, const uint32_t TypeSize = DL.getTypeStoreSizeInBits(OrigTy); FunctionCallee OnAccessFunc = nullptr; - if (Alignment == 0 || Alignment >= 8 || (Alignment % (TypeSize / 8)) == 0) { + if (Alignment >= Align(8) || (Alignment.value() % (TypeSize / 8)) == 0) { if (IsCompoundRW) OnAccessFunc = TsanCompoundRW[Idx]; else if (IsVolatile)