From 559c1d72a94dcd7dba088438359422591aa3355b Mon Sep 17 00:00:00 2001 From: Richard Diamond Date: Wed, 5 Aug 2015 22:10:57 +0000 Subject: Divide the primitive size in bits by eight so the initial load's alignment is in bytes as expected. Tested with the included unit test. llvm-svn: 244155 --- llvm/lib/CodeGen/AtomicExpandPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp index 03b0ff32f15..c10648c6e3b 100644 --- a/llvm/lib/CodeGen/AtomicExpandPass.cpp +++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp @@ -550,7 +550,7 @@ bool llvm::expandAtomicRMWToCmpXchg(AtomicRMWInst *AI, Builder.SetInsertPoint(BB); LoadInst *InitLoaded = Builder.CreateLoad(Addr); // Atomics require at least natural alignment. - InitLoaded->setAlignment(AI->getType()->getPrimitiveSizeInBits()); + InitLoaded->setAlignment(AI->getType()->getPrimitiveSizeInBits() / 8); Builder.CreateBr(LoopBB); // Start the main loop block now that we've taken care of the preliminaries. -- cgit v1.2.3