[NFC][Alignment] Use proper type in instrumentLoadOrStore

This commit is contained in:
Guillaume Chatelet 2022-06-13 12:49:50 +00:00
parent d1a27d0b9c
commit a6c2ab0c3f
1 changed files with 3 additions and 3 deletions

View File

@ -636,8 +636,8 @@ bool ThreadSanitizer::instrumentLoadOrStore(const InstructionInfo &II,
return true;
}
const unsigned Alignment = IsWrite ? cast<StoreInst>(II.Inst)->getAlignment()
: cast<LoadInst>(II.Inst)->getAlignment();
const Align Alignment = IsWrite ? cast<StoreInst>(II.Inst)->getAlign()
: cast<LoadInst>(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)