aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-06-29 21:36:04 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-06-29 21:36:04 +0000
commitc908dcde45c6d7ddff0443cbc174a7cbfec21d1b (patch)
tree124bf1f3575413595715a7dab039e4ba2d1ff475
parent98044e4a622e2cdc05b22f5d221d4c6504838d25 (diff)
downloadexternal_llvm-c908dcde45c6d7ddff0443cbc174a7cbfec21d1b.zip
external_llvm-c908dcde45c6d7ddff0443cbc174a7cbfec21d1b.tar.gz
external_llvm-c908dcde45c6d7ddff0443cbc174a7cbfec21d1b.tar.bz2
Fix a vector FP constant CSE bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37814 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 6dcba0d..9eee198 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/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<SDOperand, 8> Ops;