From: Vitaly Buka Date: Mon, 1 May 2023 02:07:57 +0000 (-0700) Subject: [NFC][HWASAN] Set constant type from another operand X-Git-Tag: upstream/17.0.6~9918 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f42f863c33f8d5fb1ce0421b48ae76a04ee221ab;p=platform%2Fupstream%2Fllvm.git [NFC][HWASAN] Set constant type from another operand --- diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp index 31f0261..e8456b7 100644 --- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp @@ -1040,7 +1040,8 @@ unsigned HWAddressSanitizer::retagMask(unsigned AllocaNo) { Value *HWAddressSanitizer::applyTagMask(IRBuilder<> &IRB, Value *OldTag) { if (TagMaskByte == 0xFF) return OldTag; // No need to clear the tag byte. - return IRB.CreateAnd(OldTag, ConstantInt::get(IntptrTy, TagMaskByte)); + return IRB.CreateAnd(OldTag, + ConstantInt::get(OldTag->getType(), TagMaskByte)); } Value *HWAddressSanitizer::getNextTagWithCall(IRBuilder<> &IRB) { @@ -1067,8 +1068,8 @@ Value *HWAddressSanitizer::getAllocaTag(IRBuilder<> &IRB, Value *StackTag, unsigned AllocaNo) { if (ClGenerateTagsWithCalls) return getNextTagWithCall(IRB); - return IRB.CreateXor(StackTag, - ConstantInt::get(IntptrTy, retagMask(AllocaNo))); + return IRB.CreateXor( + StackTag, ConstantInt::get(StackTag->getType(), retagMask(AllocaNo))); } Value *HWAddressSanitizer::getUARTag(IRBuilder<> &IRB) {