summaryrefslogtreecommitdiff
path: root/lib/SPIRV/SPIRVLowerMemmove.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SPIRV/SPIRVLowerMemmove.cpp')
-rw-r--r--lib/SPIRV/SPIRVLowerMemmove.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/SPIRV/SPIRVLowerMemmove.cpp b/lib/SPIRV/SPIRVLowerMemmove.cpp
index 8f4154a..ff269d6 100644
--- a/lib/SPIRV/SPIRVLowerMemmove.cpp
+++ b/lib/SPIRV/SPIRVLowerMemmove.cpp
@@ -79,7 +79,7 @@ public:
// The source could be bit-cast from another type,
// need the original type for the allocation of the temporary variable
SrcTy = cast<BitCastInst>(Src)->getOperand(0)->getType();
- auto Align = I.getAlignment();
+ auto Align = I.getSourceAlignment();
auto Volatile = I.isVolatile();
Value *NumElements = nullptr;
uint64_t ElementsCount = 1;
@@ -94,10 +94,11 @@ public:
auto *Alloca = Builder.CreateAlloca(SrcTy->getPointerElementType(),
NumElements);
+ Alloca->setAlignment(Align);
Builder.CreateLifetimeStart(Alloca);
- Builder.CreateMemCpy(Alloca, Src, Length, Align, Volatile);
- auto *SecondCpy = Builder.CreateMemCpy(Dest, Alloca, Length, Align,
- Volatile);
+ Builder.CreateMemCpy(Alloca, Align, Src, Align, Length, Volatile);
+ auto *SecondCpy = Builder.CreateMemCpy(Dest, I.getDestAlignment(), Alloca,
+ Align, Length, Volatile);
Builder.CreateLifetimeEnd(Alloca);
SecondCpy->takeName(&I);