[llvm] 009fe07 - [Alignment] Remove multiply by MaybeAlign
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 01:37:27 PDT 2022
Author: Guillaume Chatelet
Date: 2022-06-20T08:37:15Z
New Revision: 009fe0755e47ef824aa4066d51db75aa9021399b
URL: https://github.com/llvm/llvm-project/commit/009fe0755e47ef824aa4066d51db75aa9021399b
DIFF: https://github.com/llvm/llvm-project/commit/009fe0755e47ef824aa4066d51db75aa9021399b.diff
LOG: [Alignment] Remove multiply by MaybeAlign
Added:
Modified:
llvm/include/llvm/Support/Alignment.h
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/Alignment.h b/llvm/include/llvm/Support/Alignment.h
index c4d00ed6de6ee..6cfb9bf8e40f9 100644
--- a/llvm/include/llvm/Support/Alignment.h
+++ b/llvm/include/llvm/Support/Alignment.h
@@ -319,11 +319,6 @@ inline Align operator*(Align Lhs, uint64_t Rhs) {
return Align(Lhs.value() * Rhs);
}
-inline MaybeAlign operator*(MaybeAlign Lhs, uint64_t Rhs) {
- assert(Rhs > 0 && "Rhs must be positive");
- return Lhs ? Lhs.getValue() * Rhs : MaybeAlign();
-}
-
inline Align operator/(Align Lhs, uint64_t Divisor) {
assert(llvm::isPowerOf2_64(Divisor) &&
"Divisor must be positive and a power of 2");
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index b40e5bfb00df2..6815688827d21 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -2746,13 +2746,8 @@ void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) {
auto *MTI = cast<MemTransferInst>(
IRB.CreateCall(I.getFunctionType(), I.getCalledOperand(),
{DestShadow, SrcShadow, LenShadow, I.getVolatileCst()}));
- if (ClPreserveAlignment) {
- MTI->setDestAlignment(I.getDestAlign() * DFSF.DFS.ShadowWidthBytes);
- MTI->setSourceAlignment(I.getSourceAlign() * DFSF.DFS.ShadowWidthBytes);
- } else {
- MTI->setDestAlignment(Align(DFSF.DFS.ShadowWidthBytes));
- MTI->setSourceAlignment(Align(DFSF.DFS.ShadowWidthBytes));
- }
+ MTI->setDestAlignment(DFSF.getShadowAlign(I.getDestAlign().valueOrOne()));
+ MTI->setSourceAlignment(DFSF.getShadowAlign(I.getSourceAlign().valueOrOne()));
if (ClEventCallbacks) {
IRB.CreateCall(DFSF.DFS.DFSanMemTransferCallbackFn,
{RawDestShadow,
More information about the llvm-commits
mailing list