Atomic load/store must explicit define alignment.

This commit is contained in:
Siu Kwan Lam 2012-08-03 14:13:22 -07:00
commit 5e15b27909
6 changed files with 78 additions and 14 deletions

View file

@ -193,7 +193,8 @@ LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef builder, const char * opname,
}
LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef builder, LLVMValueRef ptr,
const char* ordering, int crossthread)
unsigned align, const char* ordering,
int crossthread)
{
using namespace llvm;
AtomicOrdering atomic_order = atomic_ordering_from_string(ordering);
@ -202,13 +203,15 @@ LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef builder, LLVMValueRef ptr,
LoadInst * inst = unwrap(builder)->CreateLoad(unwrap(ptr));
inst->setAtomic(atomic_order, sync_scope);
inst->setAlignment(align);
return wrap(inst);
}
LLVMValueRef LLVMBuildAtomicStore(LLVMBuilderRef builder,
LLVMValueRef ptr, LLVMValueRef val,
const char* ordering, int crossthread)
unsigned align, const char* ordering,
int crossthread)
{
using namespace llvm;
AtomicOrdering atomic_order = atomic_ordering_from_string(ordering);
@ -217,6 +220,7 @@ LLVMValueRef LLVMBuildAtomicStore(LLVMBuilderRef builder,
StoreInst * inst = unwrap(builder)->CreateStore(unwrap(val), unwrap(ptr));
inst->setAtomic(atomic_order, sync_scope);
inst->setAlignment(align);
return wrap(inst);
}