mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
try again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89990 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
518c988ae9
commit
cca130bb66
@ -700,7 +700,6 @@ static bool isPHITranslatable(Instruction *Inst) {
|
||||
|
||||
// We can translate a GEP that uses a PHI in the current block for at least
|
||||
// one of its operands.
|
||||
if (0)
|
||||
if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) {
|
||||
for (unsigned i = 0, e = GEP->getNumOperands(); i != e; ++i)
|
||||
if (PHINode *PN = dyn_cast<PHINode>(GEP->getOperand(i)))
|
||||
@ -747,11 +746,11 @@ static Value *PHITranslateForPred(Instruction *Inst, BasicBlock *Pred,
|
||||
if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) {
|
||||
SmallVector<Value*, 8> GEPOps;
|
||||
Value *APHIOp = 0;
|
||||
BasicBlock *CurBB = GEP->getParent();
|
||||
for (unsigned i = 0, e = GEP->getNumOperands(); i != e; ++i) {
|
||||
GEPOps.push_back(GEP->getOperand(i));
|
||||
if (PHINode *PN = dyn_cast<PHINode>(GEP->getOperand(i)))
|
||||
if (PN->getParent() == GEP->getParent())
|
||||
GEPOps.back() = APHIOp = PN->getIncomingValueForBlock(Pred);
|
||||
GEPOps.push_back(GEP->getOperand(i)->DoPHITranslation(CurBB, Pred));
|
||||
if (!isa<Constant>(GEPOps.back()))
|
||||
APHIOp = GEPOps.back();
|
||||
}
|
||||
|
||||
// Simplify the GEP to handle 'gep x, 0' -> x etc.
|
||||
@ -762,9 +761,9 @@ static Value *PHITranslateForPred(Instruction *Inst, BasicBlock *Pred,
|
||||
for (Value::use_iterator UI = APHIOp->use_begin(), E = APHIOp->use_end();
|
||||
UI != E; ++UI) {
|
||||
if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(*UI))
|
||||
if (GEPI->getType() == GEPI->getType() &&
|
||||
if (GEPI->getType() == GEP->getType() &&
|
||||
GEPI->getNumOperands() == GEPOps.size() &&
|
||||
GEPI->getParent()->getParent() == Inst->getParent()->getParent()) {
|
||||
GEPI->getParent()->getParent() == CurBB->getParent()) {
|
||||
bool Mismatch = false;
|
||||
for (unsigned i = 0, e = GEPOps.size(); i != e; ++i)
|
||||
if (GEPI->getOperand(i) != GEPOps[i]) {
|
||||
|
@ -80,9 +80,9 @@ bb2:
|
||||
%i = phi i32 [ 7, %bb1 ], [ 17, %bb ]
|
||||
%d1 = getelementptr i32* %d, i32 %i
|
||||
%dv = load i32* %d1
|
||||
; HECK: %dv = phi i32 [ 82, %bb1 ], [ 4, %bb ]
|
||||
; HECK-NOT: load
|
||||
; HECK: ret i32 %dv
|
||||
; CHECK: %dv = phi i32 [ 82, %bb1 ], [ 4, %bb ]
|
||||
; CHECK-NOT: load
|
||||
; CHECK: ret i32 %dv
|
||||
ret i32 %dv
|
||||
}
|
||||
|
||||
@ -106,9 +106,9 @@ bb2:
|
||||
%i = phi i32 [ 7, %bb1 ], [ 0, %bb ]
|
||||
%d1 = getelementptr i32* %d, i32 %i
|
||||
%dv = load i32* %d1
|
||||
; HECK: %dv = phi i32 [ 82, %bb1 ], [ 4, %bb ]
|
||||
; HECK-NOT: load
|
||||
; HECK: ret i32 %dv
|
||||
; CHECK: %dv = phi i32 [ 82, %bb1 ], [ 4, %bb ]
|
||||
; CHECK-NOT: load
|
||||
; CHECK: ret i32 %dv
|
||||
ret i32 %dv
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user