summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-10-12 18:15:33 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-10-12 18:15:33 +0000
commitbc357e8fa361021dd53f4b86234e034500d9493d (patch)
treedb1b8af24d1b18e178d8cb32ed82518ebca6f559 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parentcc88ce36ed6dd8f87b3045da30d224adc64815cc (diff)
downloadbcm5719-llvm-bc357e8fa361021dd53f4b86234e034500d9493d.tar.gz
bcm5719-llvm-bc357e8fa361021dd53f4b86234e034500d9493d.zip
[SimplifyCFG] Don't create PHI nodes for constant bundle operands
Summary: Constant bundle operands may need to retain their constant-ness for correctness. I'll admit that this is slightly odd, but it looks like SimplifyCFG already does this for things like @llvm.frameaddress and @llvm.stackmap, so I suppose adding one more case is not a big deal. It is possible to add a mechanism to denote bundle operands that need to remain constants, but that's probably too complicated for the time being. Reviewers: jmolloy Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D25502 llvm-svn: 284028
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 63b9f4061f2..a45a0c75b46 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1362,7 +1362,16 @@ static bool canReplaceOperandWithVariable(const Instruction *I,
// FIXME: many arithmetic intrinsics have no issue taking a
// variable, however it's hard to distingish these from
// specials such as @llvm.frameaddress that require a constant.
- return !isa<IntrinsicInst>(I);
+ if (isa<IntrinsicInst>(I))
+ return false;
+
+ // Constant bundle operands may need to retain their constant-ness for
+ // correctness.
+ if (ImmutableCallSite(I).isBundleOperand(OpIdx))
+ return false;
+
+ return true;
+
case Instruction::ShuffleVector:
// Shufflevector masks are constant.
return OpIdx != 2;
OpenPOWER on IntegriCloud