[llvm] eddb728 - [NFC] use bitwise or instead of addition

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 15:35:01 PST 2022


Author: Florian Mayer
Date: 2022-12-19T15:34:31-08:00
New Revision: eddb7280462ca316ba8d4d9fa6f175e8e2e65b72

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

LOG: [NFC] use bitwise or instead of addition

as the bits are all distinct, these two operations have the same result,
but the bitwise operation is more explicit about what's happening.

Reviewed By: hctim

Differential Revision: https://reviews.llvm.org/D140346

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 d8d8680532964..e6209f52b27bd 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -818,11 +818,11 @@ Value *HWAddressSanitizer::memToShadow(Value *Mem, IRBuilder<> &IRB) {
 
 int64_t HWAddressSanitizer::getAccessInfo(bool IsWrite,
                                           unsigned AccessSizeIndex) {
-  return (CompileKernel << HWASanAccessInfo::CompileKernelShift) +
-         (HasMatchAllTag << HWASanAccessInfo::HasMatchAllShift) +
-         (MatchAllTag << HWASanAccessInfo::MatchAllShift) +
-         (Recover << HWASanAccessInfo::RecoverShift) +
-         (IsWrite << HWASanAccessInfo::IsWriteShift) +
+  return (CompileKernel << HWASanAccessInfo::CompileKernelShift) |
+         (HasMatchAllTag << HWASanAccessInfo::HasMatchAllShift) |
+         (MatchAllTag << HWASanAccessInfo::MatchAllShift) |
+         (Recover << HWASanAccessInfo::RecoverShift) |
+         (IsWrite << HWASanAccessInfo::IsWriteShift) |
          (AccessSizeIndex << HWASanAccessInfo::AccessSizeShift);
 }
 


        


More information about the llvm-commits mailing list