[PATCH] D140346: [NFC] use bitwise or instead of addition
Florian Mayer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 19 13:25:24 PST 2022
fmayer created this revision.
Herald added subscribers: Enna1, hiraditya.
Herald added a project: All.
fmayer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
as the bits are all distinct, these two operations have the same result,
but the bitwise operation is more explicit about what's happening.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140346
Files:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -818,11 +818,11 @@
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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140346.484054.patch
Type: text/x-patch
Size: 1099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221219/47de2fea/attachment-0001.bin>
More information about the llvm-commits
mailing list