AVX bugfix with alignment for store instructions.
When replacing 'all on' masked store with regular store, set alignment to be the vector element alignment, not the alignment for a whole vector. (i.e. 4 or 8 byte alignment, not 32 or 64).
This commit is contained in:
6
opt.cpp
6
opt.cpp
@@ -637,10 +637,14 @@ IntrinsicsOpt::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
llvm::PointerType::get(storeType, 0),
|
llvm::PointerType::get(storeType, 0),
|
||||||
"ptr2vec", callInst);
|
"ptr2vec", callInst);
|
||||||
lCopyMetadata(castPtr, callInst);
|
lCopyMetadata(castPtr, callInst);
|
||||||
llvm::Instruction *storeInst =
|
|
||||||
|
llvm::StoreInst *storeInst =
|
||||||
new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL);
|
new llvm::StoreInst(rvalue, castPtr, (llvm::Instruction *)NULL);
|
||||||
|
int align = callInst->getCalledFunction() == avxMaskedStore32 ? 4 : 8;
|
||||||
|
storeInst->setAlignment(align);
|
||||||
lCopyMetadata(storeInst, callInst);
|
lCopyMetadata(storeInst, callInst);
|
||||||
llvm::ReplaceInstWithInst(callInst, storeInst);
|
llvm::ReplaceInstWithInst(callInst, storeInst);
|
||||||
|
|
||||||
modifiedAny = true;
|
modifiedAny = true;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user