forked from OSchip/llvm-project
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
This commit is contained in:
parent
36e7e52aa4
commit
559c1d72a9
|
@ -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.
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
; RUN: opt -S %s -atomic-expand -mtriple=i686-linux-gnu | FileCheck %s
|
||||
|
||||
define i8 @test_initial_load(i8* %ptr, i8 %value) {
|
||||
%res = atomicrmw nand i8* %ptr, i8 %value seq_cst
|
||||
ret i8 %res
|
||||
}
|
||||
; CHECK-LABEL: @test_initial_load
|
||||
; CHECK-NEXT: %1 = load i8, i8* %ptr, align 1
|
Loading…
Reference in New Issue