summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
diff options
context:
space:
mode:
authorMarek Olsak <marek.olsak@amd.com>2018-05-15 21:41:55 +0000
committerMarek Olsak <marek.olsak@amd.com>2018-05-15 21:41:55 +0000
commit3c5fd145c5f6fc2ee570e9c329700f8a9960eae0 (patch)
tree3e561416617f0dcf327280d0436c6d55ee2f3600 /llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
parent091fed94ae701005ccfde290713c4908e25008d4 (diff)
downloadbcm5719-llvm-3c5fd145c5f6fc2ee570e9c329700f8a9960eae0.tar.gz
bcm5719-llvm-3c5fd145c5f6fc2ee570e9c329700f8a9960eae0.zip
StructurizeCFG: fix inverting conditions
Author: Samuel Pitoiset Without this patch, it appears to me that we are selecting the wrong operand when inverting conditions. In the attached test, it will select %tmp3 instead of %tmp4. To fix it, just use 'A' as everywhere. This fixes a regression introduced by "[PatternMatch] define m_Not using m_Xor and cst_pred_ty" https://reviews.llvm.org/D46351 llvm-svn: 332403
Diffstat (limited to 'llvm/lib/Transforms/Scalar/StructurizeCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/StructurizeCFG.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index f0ddc30beff..12976ee0c9e 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -380,8 +380,9 @@ Value *StructurizeCFG::invert(Value *Condition) {
return ConstantExpr::getNot(C);
// Second: If the condition is already inverted, return the original value
- if (match(Condition, m_Not(m_Value(Condition))))
- return Condition;
+ Value *NotCondition;
+ if (match(Condition, m_Not(m_Value(NotCondition))))
+ return NotCondition;
if (Instruction *Inst = dyn_cast<Instruction>(Condition)) {
// Third: Check all the users for an invert
OpenPOWER on IntegriCloud