From: Jim Laskey Date: Wed, 11 Oct 2006 18:55:16 +0000 (+0000) Subject: Alias analysis of TRUNCSTORE. X-Git-Tag: android-x86-6.0-r1~1003^2~40299 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7aed46c25b9c1527b4112e71060f35c4f9c6b024;p=android-x86%2Fexternal-llvm.git Alias analysis of TRUNCSTORE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30889 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index c2ad07125c7..737c0685536 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -503,6 +503,8 @@ SDOperand DAGCombiner::visit(SDNode *N) { case ISD::BRCOND: return visitBRCOND(N); case ISD::BR_CC: return visitBR_CC(N); case ISD::LOAD: return visitLOAD(N); + // FIXME - Switch over after StoreSDNode comes online. + case ISD::TRUNCSTORE: // Fail thru case ISD::STORE: return visitSTORE(N); case ISD::INSERT_VECTOR_ELT: return visitINSERT_VECTOR_ELT(N); case ISD::VINSERT_VECTOR_ELT: return visitVINSERT_VECTOR_ELT(N); @@ -2696,6 +2698,24 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) { SDOperand Value = N->getOperand(1); SDOperand Ptr = N->getOperand(2); SDOperand SrcValue = N->getOperand(3); + + // FIXME - Switch over after StoreSDNode comes online. + if (N->getOpcode() == ISD::TRUNCSTORE) { + if (CombinerAA) { + // Walk up chain skipping non-aliasing memory nodes. + SDOperand BetterChain = FindBetterChain(N, Chain); + + // If there is a better chain. + if (Chain != BetterChain) { + // Replace the chain to avoid dependency. + SDOperand ReplTStore = DAG.getStore(BetterChain, Value, Ptr, SrcValue); + // Create token to keep both nodes around. + return DAG.getNode(ISD::TokenFactor, MVT::Other, Chain, ReplTStore); + } + } + + return SDOperand(); + } // If this is a store that kills a previous store, remove the previous store. if (Chain.getOpcode() == ISD::STORE && Chain.getOperand(2) == Ptr && @@ -3996,7 +4016,7 @@ bool DAGCombiner::FindAliasInfo(SDNode *N, SrcValue = LD->getSrcValue(); return true; } else if (StoreSDNode *ST = dyn_cast(N)) { -#if 1 //FIXME - Switch over after StoreSDNode comes online. +#if 1 // FIXME - Switch over after StoreSDNode comes online. Ptr = ST->getOperand(2); Size = MVT::getSizeInBits(ST->getOperand(1).getValueType()) >> 3; SrcValue = 0; @@ -4005,6 +4025,11 @@ bool DAGCombiner::FindAliasInfo(SDNode *N, Size = MVT::getSizeInBits(ST->getOperand(1).getValueType()) >> 3; SrcValue = ST->getSrcValue(); #endif + // FIXME - Switch over after StoreSDNode comes online. + } else if (N->getOpcode() == ISD::TRUNCSTORE) { + Ptr = N->getOperand(2); + Size = MVT::getSizeInBits(cast(N->getOperand(4))->getVT()) >> 3; + SrcValue = 0; } else { assert(0 && "FindAliasInfo expected a memory operand"); } @@ -4045,6 +4070,8 @@ void DAGCombiner::GatherAllAliases(SDNode *N, SDOperand OriginalChain, break; case ISD::LOAD: + // FIXME - Switch over after StoreSDNode comes online. + case ISD::TRUNCSTORE: case ISD::STORE: { // Get alias information for Chain. SDOperand OpPtr;