diff --git a/llvm/include/llvm/Support/Alignment.h b/llvm/include/llvm/Support/Alignment.h index c4d00ed6de6e..6cfb9bf8e40f 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 b40e5bfb00df..6815688827d2 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( 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,