[NFC] use bitwise or instead of addition
authorFlorian Mayer <fmayer@google.com>
Mon, 19 Dec 2022 21:24:34 +0000 (13:24 -0800)
committerFlorian Mayer <fmayer@google.com>
Mon, 19 Dec 2022 23:34:31 +0000 (15:34 -0800)
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

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

index d8d8680..e6209f5 100644 (file)
@@ -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);
 }