mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-12 18:33:22 +00:00
Implement getelementptr.ll:test11
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21647 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f05fd0893e
commit
9fb25db11e
@ -2879,6 +2879,22 @@ Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) {
|
|||||||
if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
|
if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
|
||||||
if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
|
if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
|
||||||
switch (LHSI->getOpcode()) {
|
switch (LHSI->getOpcode()) {
|
||||||
|
case Instruction::GetElementPtr:
|
||||||
|
if (RHSC->isNullValue()) {
|
||||||
|
// Transform setcc GEP P, int 0, int 0, int 0, null -> setcc P, null
|
||||||
|
bool isAllZeros = true;
|
||||||
|
for (unsigned i = 1, e = LHSI->getNumOperands(); i != e; ++i)
|
||||||
|
if (!isa<Constant>(LHSI->getOperand(i)) ||
|
||||||
|
!cast<Constant>(LHSI->getOperand(i))->isNullValue()) {
|
||||||
|
isAllZeros = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (isAllZeros)
|
||||||
|
return new SetCondInst(I.getOpcode(), LHSI->getOperand(0),
|
||||||
|
Constant::getNullValue(LHSI->getOperand(0)->getType()));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Instruction::PHI:
|
case Instruction::PHI:
|
||||||
if (Instruction *NV = FoldOpIntoPhi(I))
|
if (Instruction *NV = FoldOpIntoPhi(I))
|
||||||
return NV;
|
return NV;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user