Fix incorrect combination of different loads. Reenable zext-over-truncate

combination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2007-03-30 21:38:07 +00:00
parent b4c377f5dd
commit 2041a0ef75
2 changed files with 71 additions and 75 deletions

View File

@ -2110,9 +2110,7 @@ SDOperand DAGCombiner::visitZERO_EXTEND(SDNode *N) {
// fold (zext (truncate (load x))) -> (zext (smaller load x))
// fold (zext (truncate (srl (load x), c))) -> (zext (small load (x+c/n)))
// FIXME: Temporarily disable this for big endian machines until llvm-gcc
// build issue has been resolved.
if (TLI.isLittleEndian() && N0.getOpcode() == ISD::TRUNCATE) {
if (N0.getOpcode() == ISD::TRUNCATE) {
SDOperand NarrowLoad = ReduceLoadWidth(N0.Val);
if (NarrowLoad.Val) {
if (NarrowLoad.Val != N0.Val)

View File

@ -285,78 +285,76 @@ static void AddNodeIDNode(FoldingSetNodeID &ID, SDNode *N) {
AddNodeIDOperands(ID, N->op_begin(), N->getNumOperands());
// Handle SDNode leafs with special info.
if (N->getNumOperands() == 0) {
switch (N->getOpcode()) {
default: break; // Normal nodes don't need extra info.
case ISD::TargetConstant:
case ISD::Constant:
ID.AddInteger(cast<ConstantSDNode>(N)->getValue());
break;
case ISD::TargetConstantFP:
case ISD::ConstantFP:
ID.AddDouble(cast<ConstantFPSDNode>(N)->getValue());
break;
case ISD::TargetGlobalAddress:
case ISD::GlobalAddress: {
GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(N);
ID.AddPointer(GA->getGlobal());
ID.AddInteger(GA->getOffset());
break;
}
case ISD::BasicBlock:
ID.AddPointer(cast<BasicBlockSDNode>(N)->getBasicBlock());
break;
case ISD::Register:
ID.AddInteger(cast<RegisterSDNode>(N)->getReg());
break;
case ISD::SRCVALUE: {
SrcValueSDNode *SV = cast<SrcValueSDNode>(N);
ID.AddPointer(SV->getValue());
ID.AddInteger(SV->getOffset());
break;
}
case ISD::FrameIndex:
case ISD::TargetFrameIndex:
ID.AddInteger(cast<FrameIndexSDNode>(N)->getIndex());
break;
case ISD::JumpTable:
case ISD::TargetJumpTable:
ID.AddInteger(cast<JumpTableSDNode>(N)->getIndex());
break;
case ISD::ConstantPool:
case ISD::TargetConstantPool: {
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(N);
ID.AddInteger(CP->getAlignment());
ID.AddInteger(CP->getOffset());
if (CP->isMachineConstantPoolEntry())
CP->getMachineCPVal()->AddSelectionDAGCSEId(ID);
else
ID.AddPointer(CP->getConstVal());
break;
}
case ISD::LOAD: {
LoadSDNode *LD = cast<LoadSDNode>(N);
ID.AddInteger(LD->getAddressingMode());
ID.AddInteger(LD->getExtensionType());
ID.AddInteger(LD->getLoadedVT());
ID.AddPointer(LD->getSrcValue());
ID.AddInteger(LD->getSrcValueOffset());
ID.AddInteger(LD->getAlignment());
ID.AddInteger(LD->isVolatile());
break;
}
case ISD::STORE: {
StoreSDNode *ST = cast<StoreSDNode>(N);
ID.AddInteger(ST->getAddressingMode());
ID.AddInteger(ST->isTruncatingStore());
ID.AddInteger(ST->getStoredVT());
ID.AddPointer(ST->getSrcValue());
ID.AddInteger(ST->getSrcValueOffset());
ID.AddInteger(ST->getAlignment());
ID.AddInteger(ST->isVolatile());
break;
}
}
switch (N->getOpcode()) {
default: break; // Normal nodes don't need extra info.
case ISD::TargetConstant:
case ISD::Constant:
ID.AddInteger(cast<ConstantSDNode>(N)->getValue());
break;
case ISD::TargetConstantFP:
case ISD::ConstantFP:
ID.AddDouble(cast<ConstantFPSDNode>(N)->getValue());
break;
case ISD::TargetGlobalAddress:
case ISD::GlobalAddress: {
GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(N);
ID.AddPointer(GA->getGlobal());
ID.AddInteger(GA->getOffset());
break;
}
case ISD::BasicBlock:
ID.AddPointer(cast<BasicBlockSDNode>(N)->getBasicBlock());
break;
case ISD::Register:
ID.AddInteger(cast<RegisterSDNode>(N)->getReg());
break;
case ISD::SRCVALUE: {
SrcValueSDNode *SV = cast<SrcValueSDNode>(N);
ID.AddPointer(SV->getValue());
ID.AddInteger(SV->getOffset());
break;
}
case ISD::FrameIndex:
case ISD::TargetFrameIndex:
ID.AddInteger(cast<FrameIndexSDNode>(N)->getIndex());
break;
case ISD::JumpTable:
case ISD::TargetJumpTable:
ID.AddInteger(cast<JumpTableSDNode>(N)->getIndex());
break;
case ISD::ConstantPool:
case ISD::TargetConstantPool: {
ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(N);
ID.AddInteger(CP->getAlignment());
ID.AddInteger(CP->getOffset());
if (CP->isMachineConstantPoolEntry())
CP->getMachineCPVal()->AddSelectionDAGCSEId(ID);
else
ID.AddPointer(CP->getConstVal());
break;
}
case ISD::LOAD: {
LoadSDNode *LD = cast<LoadSDNode>(N);
ID.AddInteger(LD->getAddressingMode());
ID.AddInteger(LD->getExtensionType());
ID.AddInteger(LD->getLoadedVT());
ID.AddPointer(LD->getSrcValue());
ID.AddInteger(LD->getSrcValueOffset());
ID.AddInteger(LD->getAlignment());
ID.AddInteger(LD->isVolatile());
break;
}
case ISD::STORE: {
StoreSDNode *ST = cast<StoreSDNode>(N);
ID.AddInteger(ST->getAddressingMode());
ID.AddInteger(ST->isTruncatingStore());
ID.AddInteger(ST->getStoredVT());
ID.AddPointer(ST->getSrcValue());
ID.AddInteger(ST->getSrcValueOffset());
ID.AddInteger(ST->getAlignment());
ID.AddInteger(ST->isVolatile());
break;
}
}
}