mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Refactor operation equivalence checking in BBVectorize by extending Instruction::isSameOperationAs.
Maintaining this kind of checking in different places is dangerous, extending Instruction::isSameOperationAs consolidates this logic into one place. Here I've added an optional flags parameter and two flags that are important for vectorization: CompareIgnoringAlignment and CompareUsingScalarTypes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159329 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -660,30 +660,9 @@ namespace {
|
||||
|
||||
// Loads and stores can be merged if they have different alignments,
|
||||
// but are otherwise the same.
|
||||
LoadInst *LI, *LJ;
|
||||
StoreInst *SI, *SJ;
|
||||
if ((LI = dyn_cast<LoadInst>(I)) && (LJ = dyn_cast<LoadInst>(J))) {
|
||||
if (I->getType() != J->getType())
|
||||
return false;
|
||||
|
||||
if (LI->getPointerOperand()->getType() !=
|
||||
LJ->getPointerOperand()->getType() ||
|
||||
LI->isVolatile() != LJ->isVolatile() ||
|
||||
LI->getOrdering() != LJ->getOrdering() ||
|
||||
LI->getSynchScope() != LJ->getSynchScope())
|
||||
return false;
|
||||
} else if ((SI = dyn_cast<StoreInst>(I)) && (SJ = dyn_cast<StoreInst>(J))) {
|
||||
if (SI->getValueOperand()->getType() !=
|
||||
SJ->getValueOperand()->getType() ||
|
||||
SI->getPointerOperand()->getType() !=
|
||||
SJ->getPointerOperand()->getType() ||
|
||||
SI->isVolatile() != SJ->isVolatile() ||
|
||||
SI->getOrdering() != SJ->getOrdering() ||
|
||||
SI->getSynchScope() != SJ->getSynchScope())
|
||||
return false;
|
||||
} else if (!J->isSameOperationAs(I)) {
|
||||
if (!J->isSameOperationAs(I, Instruction::CompareIgnoringAlignment))
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME: handle addsub-type operations!
|
||||
|
||||
if (IsSimpleLoadStore) {
|
||||
|
Reference in New Issue
Block a user