summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-01-24 20:18:00 +0000
committerJuergen Ributzka <juergen@apple.com>2014-01-24 20:18:00 +0000
commit4f3df4ad648b5e683a7ae37ab5ab03cecc5f1b3b (patch)
tree632ad16ca67d672c155239dda472aff945af4d99 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parent51a9838049dae8d6023a8cfa79cced3733cd17ab (diff)
downloadbcm5719-llvm-4f3df4ad648b5e683a7ae37ab5ab03cecc5f1b3b.tar.gz
bcm5719-llvm-4f3df4ad648b5e683a7ae37ab5ab03cecc5f1b3b.zip
Add Constant Hoisting Pass
Retry commit r200022 with a fix for the build bot errors. Constant expressions have (unlike instructions) module scope use lists and therefore may have users in different functions. The fix is to simply ignore these out-of-function uses. llvm-svn: 200034
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 6c8e2f83a4f..a561c5190ac 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2945,6 +2945,9 @@ void SelectionDAGBuilder::visitBitCast(const User &I) {
if (DestVT != N.getValueType())
setValue(&I, DAG.getNode(ISD::BITCAST, getCurSDLoc(),
DestVT, N)); // convert types.
+ else if(ConstantSDNode *C = dyn_cast<ConstantSDNode>(N))
+ setValue(&I, DAG.getConstant(C->getAPIntValue(), C->getValueType(0),
+ /*isTarget=*/false, /*isOpaque*/true));
else
setValue(&I, N); // noop cast.
}
OpenPOWER on IntegriCloud