Fixed a number of issues related to memory alignment; a number of places
were expecting vector-width-aligned pointers where in point of fact, there's no guarantee that they would have been in general. Removed the aligned memory allocation routines from some of the examples; they're no longer needed. No perf. difference on Core2/Core i5 CPUs; older CPUs may see some regressions. Still need to update the documentation for this change and finish reviewing alignment issues in Load/Store instructions generated by .cpp files.
This commit is contained in:
11
opt.cpp
11
opt.cpp
@@ -1131,10 +1131,17 @@ MaskedStoreOptPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
||||
}
|
||||
else if (maskAsInt == allOnMask) {
|
||||
// The mask is all on, so turn this into a regular store
|
||||
const llvm::Type *ptrType = llvm::PointerType::get(rvalue->getType(), 0);
|
||||
const llvm::Type *rvalueType = rvalue->getType();
|
||||
const llvm::Type *ptrType = llvm::PointerType::get(rvalueType, 0);
|
||||
// Need to update this when int8/int16 are added
|
||||
int align = (called == pms32Func || called == pms64Func ||
|
||||
called == msb32Func) ? 4 : 8;
|
||||
|
||||
lvalue = new llvm::BitCastInst(lvalue, ptrType, "lvalue_to_ptr_type", callInst);
|
||||
lCopyMetadata(lvalue, callInst);
|
||||
llvm::Instruction *store = new llvm::StoreInst(rvalue, lvalue);
|
||||
llvm::Instruction *store =
|
||||
new llvm::StoreInst(rvalue, lvalue, false /* not volatile */,
|
||||
align);
|
||||
lCopyMetadata(store, callInst);
|
||||
llvm::ReplaceInstWithInst(callInst, store);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user