From 9458e6a551548ab143f1ba9466931de20c65d745 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 29 Jun 2007 21:36:04 +0000 Subject: [PATCH] Fix a vector FP constant CSE bug. llvm-svn: 37814 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 6dcba0d9d6b4..9eee1984af7e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -686,11 +686,16 @@ SDOperand SelectionDAG::getConstantFP(double Val, MVT::ValueType VT, AddNodeIDNode(ID, Opc, getVTList(EltVT), 0, 0); ID.AddDouble(Val); void *IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) - return SDOperand(E, 0); - SDNode *N = new ConstantFPSDNode(isTarget, Val, EltVT); - CSEMap.InsertNode(N, IP); - AllNodes.push_back(N); + SDNode *N = NULL; + if ((N = CSEMap.FindNodeOrInsertPos(ID, IP))) + if (!MVT::isVector(VT)) + return SDOperand(N, 0); + if (!N) { + N = new ConstantFPSDNode(isTarget, Val, EltVT); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + } + SDOperand Result(N, 0); if (MVT::isVector(VT)) { SmallVector Ops;