diff options
author | Davide Italiano <davide@freebsd.org> | 2017-05-01 22:26:28 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2017-05-01 22:26:28 +0000 |
commit | 2dfd46bf086cd487139a5fc998e3ae4a735cc8db (patch) | |
tree | 1b1bbfb0cb8e4f2a235e248ada660eaf2dca1ac2 /llvm/lib/Transforms | |
parent | 59d0aeaafe275cc20fafca52b21c4610c681a156 (diff) | |
download | bcm5719-llvm-2dfd46bf086cd487139a5fc998e3ae4a735cc8db.tar.gz bcm5719-llvm-2dfd46bf086cd487139a5fc998e3ae4a735cc8db.zip |
[NewGVN] Don't derive incorrect implications.
In the testcase attached, we believe %tmp1 implies %tmp4.
where:
br i1 %tmp1, label %bb2, label %bb7
br i1 %tmp4, label %bb5, label %bb7
because Wwhile looking at PredicateInfo stuffs we end up calling
isImpliedTrueByMatchingCmp() with the arguments backwards.
Differential Revision: https://reviews.llvm.org/D32718
llvm-svn: 301849
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index 18d31f16a74..162d91beae7 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -1628,15 +1628,15 @@ const Expression *NewGVN::performSymbolicCmpEvaluation(Instruction *I) { if (PBranch->TrueEdge) { // If we know the previous predicate is true and we are in the true // edge then we may be implied true or false. - if (CmpInst::isImpliedTrueByMatchingCmp(OurPredicate, - BranchPredicate)) { + if (CmpInst::isImpliedTrueByMatchingCmp(BranchPredicate, + OurPredicate)) { addPredicateUsers(PI, I); return createConstantExpression( ConstantInt::getTrue(CI->getType())); } - if (CmpInst::isImpliedFalseByMatchingCmp(OurPredicate, - BranchPredicate)) { + if (CmpInst::isImpliedFalseByMatchingCmp(BranchPredicate, + OurPredicate)) { addPredicateUsers(PI, I); return createConstantExpression( ConstantInt::getFalse(CI->getType())); |