mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
When replacing uses and the same node is reached
via two paths, process it once not twice, d'oh! Analysis, testcase and original patch thanks to Mon Ping Wang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62169 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
87b8cce21c
commit
2ecf88d175
@ -15,7 +15,7 @@
|
||||
|
||||
#include "LegalizeTypes.h"
|
||||
#include "llvm/CallingConv.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
using namespace llvm;
|
||||
@ -628,13 +628,11 @@ namespace {
|
||||
class VISIBILITY_HIDDEN NodeUpdateListener :
|
||||
public SelectionDAG::DAGUpdateListener {
|
||||
DAGTypeLegalizer &DTL;
|
||||
SmallVectorImpl<SDNode*> &NodesToAnalyze;
|
||||
SmallPtrSet<SDNode*, 16> &NodesDeleted;
|
||||
SmallSetVector<SDNode*, 16> &NodesToAnalyze;
|
||||
public:
|
||||
explicit NodeUpdateListener(DAGTypeLegalizer &dtl,
|
||||
SmallVectorImpl<SDNode*> &nta,
|
||||
SmallPtrSet<SDNode*, 16> &nd)
|
||||
: DTL(dtl), NodesToAnalyze(nta), NodesDeleted(nd) {}
|
||||
SmallSetVector<SDNode*, 16> &nta)
|
||||
: DTL(dtl), NodesToAnalyze(nta) {}
|
||||
|
||||
virtual void NodeDeleted(SDNode *N, SDNode *E) {
|
||||
assert(N->getNodeId() != DAGTypeLegalizer::ReadyToProcess &&
|
||||
@ -647,14 +645,14 @@ namespace {
|
||||
|
||||
// In theory the deleted node could also have been scheduled for analysis.
|
||||
// So add it to the set of nodes which will not be analyzed.
|
||||
NodesDeleted.insert(N);
|
||||
NodesToAnalyze.remove(N);
|
||||
|
||||
// In general nothing needs to be done for E, since it didn't change but
|
||||
// only gained new uses. However N -> E was just added to ReplacedValues,
|
||||
// and the result of a ReplacedValues mapping is not allowed to be marked
|
||||
// NewNode. So if E is marked NewNode, then it needs to be analyzed.
|
||||
if (E->getNodeId() == DAGTypeLegalizer::NewNode)
|
||||
NodesToAnalyze.push_back(E);
|
||||
NodesToAnalyze.insert(E);
|
||||
}
|
||||
|
||||
virtual void NodeUpdated(SDNode *N) {
|
||||
@ -664,7 +662,7 @@ namespace {
|
||||
assert(N->getNodeId() != DAGTypeLegalizer::ReadyToProcess &&
|
||||
N->getNodeId() != DAGTypeLegalizer::Processed &&
|
||||
"Invalid node ID for RAUW deletion!");
|
||||
NodesToAnalyze.push_back(N);
|
||||
NodesToAnalyze.insert(N);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -684,9 +682,8 @@ void DAGTypeLegalizer::ReplaceValueWith(SDValue From, SDValue To) {
|
||||
|
||||
// Anything that used the old node should now use the new one. Note that this
|
||||
// can potentially cause recursive merging.
|
||||
SmallVector<SDNode*, 16> NodesToAnalyze;
|
||||
SmallPtrSet<SDNode*, 16> NodesDeleted;
|
||||
NodeUpdateListener NUL(*this, NodesToAnalyze, NodesDeleted);
|
||||
SmallSetVector<SDNode*, 16> NodesToAnalyze;
|
||||
NodeUpdateListener NUL(*this, NodesToAnalyze);
|
||||
DAG.ReplaceAllUsesOfValueWith(From, To, &NUL);
|
||||
|
||||
// The old node may still be present in a map like ExpandedIntegers or
|
||||
@ -698,10 +695,6 @@ void DAGTypeLegalizer::ReplaceValueWith(SDValue From, SDValue To) {
|
||||
SDNode *N = NodesToAnalyze.back();
|
||||
NodesToAnalyze.pop_back();
|
||||
|
||||
// Do not analyze deleted nodes!
|
||||
if (NodesDeleted.count(N))
|
||||
continue;
|
||||
|
||||
// Analyze the node's operands and recalculate the node ID.
|
||||
assert(N->getNodeId() != DAGTypeLegalizer::ReadyToProcess &&
|
||||
N->getNodeId() != DAGTypeLegalizer::Processed &&
|
||||
|
21
test/CodeGen/X86/2009-01-13-DoubleUpdate.ll
Normal file
21
test/CodeGen/X86/2009-01-13-DoubleUpdate.ll
Normal file
@ -0,0 +1,21 @@
|
||||
; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -enable-legalize-types-checking
|
||||
|
||||
declare <2 x double> @llvm.x86.sse2.min.pd(<2 x double>, <2 x double>) nounwind readnone
|
||||
|
||||
define void @__mindd16(<16 x double>* sret %vec.result, <16 x double> %x, double %y) nounwind {
|
||||
entry:
|
||||
%tmp3.i = shufflevector <16 x double> zeroinitializer, <16 x double> undef, <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 > ; <<8 x double>> [#uses=1]
|
||||
%tmp10.i.i = shufflevector <8 x double> %tmp3.i, <8 x double> undef, <4 x i32> < i32 4, i32 5, i32 6, i32 7 > ; <<4 x double>> [#uses=1]
|
||||
%tmp3.i2.i.i = shufflevector <4 x double> %tmp10.i.i, <4 x double> undef, <2 x i32> < i32 0, i32 1 > ; <<2 x double>> [#uses=1]
|
||||
%0 = tail call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> zeroinitializer, <2 x double> %tmp3.i2.i.i) nounwind ; <<2 x double>> [#uses=1]
|
||||
%tmp5.i3.i.i = shufflevector <2 x double> %0, <2 x double> undef, <4 x i32> < i32 0, i32 1, i32 undef, i32 undef > ; <<4 x double>> [#uses=1]
|
||||
%tmp6.i4.i.i = shufflevector <4 x double> zeroinitializer, <4 x double> %tmp5.i3.i.i, <4 x i32> < i32 4, i32 5, i32 2, i32 3 > ; <<4 x double>> [#uses=1]
|
||||
%tmp14.i8.i.i = shufflevector <4 x double> %tmp6.i4.i.i, <4 x double> zeroinitializer, <4 x i32> < i32 0, i32 1, i32 4, i32 5 > ; <<4 x double>> [#uses=1]
|
||||
%tmp13.i.i = shufflevector <4 x double> %tmp14.i8.i.i, <4 x double> undef, <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef > ; <<8 x double>> [#uses=1]
|
||||
%tmp14.i.i = shufflevector <8 x double> zeroinitializer, <8 x double> %tmp13.i.i, <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11 > ; <<8 x double>> [#uses=1]
|
||||
%tmp5.i = shufflevector <8 x double> %tmp14.i.i, <8 x double> undef, <16 x i32> < i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef > ; <<16 x double>> [#uses=1]
|
||||
%tmp6.i = shufflevector <16 x double> %x, <16 x double> %tmp5.i, <16 x i32> < i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15 > ; <<16 x double>> [#uses=1]
|
||||
%tmp14.i = shufflevector <16 x double> %tmp6.i, <16 x double> zeroinitializer, <16 x i32> < i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23 > ; <<16 x double>> [#uses=1]
|
||||
store <16 x double> %tmp14.i, <16 x double>* %vec.result
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user