aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-07-15 22:13:16 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-07-15 22:13:16 +0000
commit93be6e8c0ada7f77b93db16c81b2160f82780ae6 (patch)
tree5c422117c761fc90f08c37cd9f52d4968666c39d /llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
parent408e300933f2c5e8aaffb2539e47b89a2112b81b (diff)
downloadllvm-93be6e8c0ada7f77b93db16c81b2160f82780ae6.zip
llvm-93be6e8c0ada7f77b93db16c81b2160f82780ae6.tar.gz
llvm-93be6e8c0ada7f77b93db16c81b2160f82780ae6.tar.bz2
StructurizeCFG: Fix inverting constantexpr conditions
llvm-svn: 275626
Diffstat (limited to 'llvm/lib/Transforms/Scalar/StructurizeCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/StructurizeCFG.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index be9b6e4..e9ac39b 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -377,14 +377,8 @@ void StructurizeCFG::analyzeLoops(RegionNode *N) {
/// \brief Invert the given condition
Value *StructurizeCFG::invert(Value *Condition) {
// First: Check if it's a constant
- if (Condition == BoolTrue)
- return BoolFalse;
-
- if (Condition == BoolFalse)
- return BoolTrue;
-
- if (Condition == BoolUndef)
- return BoolUndef;
+ if (Constant *C = dyn_cast<Constant>(Condition))
+ return ConstantExpr::getNot(C);
// Second: If the condition is already inverted, return the original value
if (match(Condition, m_Not(m_Value(Condition))))