summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2005-08-17 19:34:49 +0000
committerJim Laskey <jlaskey@mac.com>2005-08-17 19:34:49 +0000
commitb74c66618677ec27bc749c70b61d9b723c2e51c5 (patch)
treeaa4a194f382cf242fd704399685090e7b8aca85c /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentc6aa80668e67972e9c8d4b4a3cdfc285def7c246 (diff)
downloadbcm5719-llvm-b74c66618677ec27bc749c70b61d9b723c2e51c5.tar.gz
bcm5719-llvm-b74c66618677ec27bc749c70b61d9b723c2e51c5.zip
Culling out use of unions for converting FP to bits and vice versa.
llvm-svn: 22838
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 6afa9d08947..81b08039a47 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -224,12 +224,8 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
N->getValueType(0)));
break;
case ISD::ConstantFP: {
- union {
- double DV;
- uint64_t IV;
- };
- DV = cast<ConstantFPSDNode>(N)->getValue();
- ConstantFPs.erase(std::make_pair(IV, N->getValueType(0)));
+ uint64_t V = DoubleToBits(cast<ConstantFPSDNode>(N)->getValue());
+ ConstantFPs.erase(std::make_pair(V, N->getValueType(0)));
break;
}
case ISD::CONDCODE:
@@ -385,14 +381,7 @@ SDOperand SelectionDAG::getConstantFP(double Val, MVT::ValueType VT) {
// Do the map lookup using the actual bit pattern for the floating point
// value, so that we don't have problems with 0.0 comparing equal to -0.0, and
// we don't have issues with SNANs.
- union {
- double DV;
- uint64_t IV;
- };
-
- DV = Val;
-
- SDNode *&N = ConstantFPs[std::make_pair(IV, VT)];
+ SDNode *&N = ConstantFPs[std::make_pair(DoubleToBits(Val), VT)];
if (N) return SDOperand(N, 0);
N = new ConstantFPSDNode(Val, VT);
AllNodes.push_back(N);
OpenPOWER on IntegriCloud