Fix an alignment error in `llvm::expandAtomicRMWToCmpXchg` without breaking the build...
[oota-llvm.git] / lib / CodeGen / AtomicExpandPass.cpp
index 03b0ff32f15c3a9f61274a1e80bd631d400635ff..c10648c6e3bcf2cc4333701f7884f78867dabd8f 100644 (file)
@@ -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.