diff options
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/Core.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/IR/Instructions.cpp | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index d8dfcc8c916..ab7a7471d46 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -2012,7 +2012,7 @@ void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes) { else if (AllocaInst *AI = dyn_cast<AllocaInst>(P)) AI->setAlignment(Bytes); else if (LoadInst *LI = dyn_cast<LoadInst>(P)) - LI->setAlignment(Bytes); + LI->setAlignment(MaybeAlign(Bytes)); else if (StoreInst *SI = dyn_cast<StoreInst>(P)) SI->setAlignment(Bytes); else diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index f8eec2e805e..f48bf80cd58 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -1321,7 +1321,7 @@ LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile, : UnaryInstruction(Ty, Load, Ptr, InsertBef) { assert(Ty == cast<PointerType>(Ptr->getType())->getElementType()); setVolatile(isVolatile); - setAlignment(Align); + setAlignment(MaybeAlign(Align)); setAtomic(Order, SSID); AssertOK(); setName(Name); @@ -1333,16 +1333,12 @@ LoadInst::LoadInst(Type *Ty, Value *Ptr, const Twine &Name, bool isVolatile, : UnaryInstruction(Ty, Load, Ptr, InsertAE) { assert(Ty == cast<PointerType>(Ptr->getType())->getElementType()); setVolatile(isVolatile); - setAlignment(Align); + setAlignment(MaybeAlign(Align)); setAtomic(Order, SSID); AssertOK(); setName(Name); } -void LoadInst::setAlignment(unsigned Align) { - setAlignment(llvm::MaybeAlign(Align)); -} - void LoadInst::setAlignment(MaybeAlign Align) { assert((!Align || *Align <= MaximumAlignment) && "Alignment is greater than MaximumAlignment!"); |

