From 5a6712b633478adac1c1d95003af7c9ba5f9fee6 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 6 Feb 2019 12:36:17 +0000 Subject: [PATCH] [DAGCombine][NFC] GatherAllAliases should take a LSBaseSDNode. GatherAllAliases only makes sense for LSBaseSDNode. Enforce it with static typing instead of runtime cast. llvm-svn: 353291 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index e6ac8bc1d282..741eeb4f8378 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -479,7 +479,7 @@ namespace { /// Walk up chain skipping non-aliasing memory nodes, /// looking for aliasing nodes and adding them to the Aliases vector. - void GatherAllAliases(SDNode *N, SDValue OriginalChain, + void GatherAllAliases(LSBaseSDNode *N, SDValue OriginalChain, SmallVectorImpl &Aliases); /// Return true if there is any possibility that the two addresses overlap. @@ -487,7 +487,7 @@ namespace { /// Walk up chain skipping non-aliasing memory nodes, looking for a better /// chain (aliasing node.) - SDValue FindBetterChain(SDNode *N, SDValue Chain); + SDValue FindBetterChain(LSBaseSDNode *N, SDValue Chain); /// Try to replace a store and any possibly adjacent stores on /// consecutive chains with better chains. Return true only if St is @@ -13230,7 +13230,7 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) { if (LD->isUnindexed()) { // Walk up chain skipping non-aliasing memory nodes. - SDValue BetterChain = FindBetterChain(N, Chain); + SDValue BetterChain = FindBetterChain(LD, Chain); // If there is a better chain. if (Chain != BetterChain) { @@ -17765,7 +17765,7 @@ SDValue DAGCombiner::visitVECTOR_SHUFFLE(SDNode *N) { NewMask.push_back(M < 0 ? -1 : Scale * M + s); return NewMask; }; - + SDValue BC0 = peekThroughOneUseBitcasts(N0); if (BC0.getOpcode() == ISD::VECTOR_SHUFFLE && BC0.hasOneUse()) { EVT SVT = VT.getScalarType(); @@ -19210,13 +19210,13 @@ bool DAGCombiner::isAlias(LSBaseSDNode *Op0, LSBaseSDNode *Op1) const { /// Walk up chain skipping non-aliasing memory nodes, /// looking for aliasing nodes and adding them to the Aliases vector. -void DAGCombiner::GatherAllAliases(SDNode *N, SDValue OriginalChain, +void DAGCombiner::GatherAllAliases(LSBaseSDNode *N, SDValue OriginalChain, SmallVectorImpl &Aliases) { SmallVector Chains; // List of chains to visit. SmallPtrSet Visited; // Visited node set. // Get alias information for node. - bool IsLoad = isa(N) && !cast(N)->isVolatile(); + bool IsLoad = isa(N) && !N->isVolatile(); // Starting off. Chains.push_back(OriginalChain); @@ -19257,7 +19257,7 @@ void DAGCombiner::GatherAllAliases(SDNode *N, SDValue OriginalChain, // If chain is alias then stop here. if (!(IsLoad && IsOpLoad) && - isAlias(cast(N), cast(Chain.getNode()))) { + isAlias(N, cast(Chain.getNode()))) { Aliases.push_back(Chain); } else { // Look further up the chain. @@ -19297,7 +19297,7 @@ void DAGCombiner::GatherAllAliases(SDNode *N, SDValue OriginalChain, /// Walk up chain skipping non-aliasing memory nodes, looking for a better chain /// (aliasing node.) -SDValue DAGCombiner::FindBetterChain(SDNode *N, SDValue OldChain) { +SDValue DAGCombiner::FindBetterChain(LSBaseSDNode *N, SDValue OldChain) { if (OptLevel == CodeGenOpt::None) return OldChain;