summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-04-02 22:21:01 +0000
committerJuergen Ributzka <juergen@apple.com>2014-04-02 22:21:01 +0000
commitfcd2e94eccdb05f675a72ec6cbd40024cb485b12 (patch)
treea9f649c2ca087408b7cd09b529b658c474f1fb67 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentfd43f6ba3b916566dfe9e153d946c0cb702998c5 (diff)
downloadbcm5719-llvm-fcd2e94eccdb05f675a72ec6cbd40024cb485b12.tar.gz
bcm5719-llvm-fcd2e94eccdb05f675a72ec6cbd40024cb485b12.zip
Add comments and test case for [DAG] Keep the opaque constant flag when performing unary constant folding operations (r204737).
llvm-svn: 205474
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 52806235fd2..d11ce804244 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2535,7 +2535,11 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT) {
SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL,
EVT VT, SDValue Operand) {
- // Constant fold unary operations with an integer constant operand.
+ // Constant fold unary operations with an integer constant operand. Even
+ // opaque constant will be folded, because the folding of unary operations
+ // doesn't create new constants with different values. Nevertheless, the
+ // opaque flag is preserved during folding to prevent future folding with
+ // other constants.
if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Operand.getNode())) {
const APInt &Val = C->getAPIntValue();
switch (Opcode) {
OpenPOWER on IntegriCloud