[Alignment] Remove multiply by MaybeAlign

This commit is contained in:
Guillaume Chatelet 2022-06-20 08:02:09 +00:00
parent 2b089e9ae0
commit 009fe0755e
2 changed files with 2 additions and 12 deletions

View File

@ -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");

View File

@ -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,