[llvm] f42f863 - [NFC][HWASAN] Set constant type from another operand

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 30 19:08:49 PDT 2023


Author: Vitaly Buka
Date: 2023-04-30T19:07:57-07:00
New Revision: f42f863c33f8d5fb1ce0421b48ae76a04ee221ab

URL: https://github.com/llvm/llvm-project/commit/f42f863c33f8d5fb1ce0421b48ae76a04ee221ab
DIFF: https://github.com/llvm/llvm-project/commit/f42f863c33f8d5fb1ce0421b48ae76a04ee221ab.diff

LOG: [NFC][HWASAN] Set constant type from another operand

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 31f02617e958..e8456b7b9bd1 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) {


        


More information about the llvm-commits mailing list