diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-19 17:19:14 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-19 17:19:14 +0000 |
commit | b7dfbb40a3fd9491c0188eca0ed2af66fa5ef44f (patch) | |
tree | 16244dfe2289ef44c3491a20a63af0f9516cfaa5 /llvm/include | |
parent | 79e096dbaf974a775e72181d748c4e7c3e659047 (diff) | |
download | bcm5719-llvm-b7dfbb40a3fd9491c0188eca0ed2af66fa5ef44f.tar.gz bcm5719-llvm-b7dfbb40a3fd9491c0188eca0ed2af66fa5ef44f.zip |
[ValueTracking] Improve isImpliedCondition for conditions with matching operands.
This patch improves SimplifyCFG to catch cases like:
if (a < b) {
if (a > b) <- known to be false
unreachable;
}
Phabricator Revision: http://reviews.llvm.org/D18905
llvm-svn: 266767
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/Analysis/ValueTracking.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h index 2486f2fdd8d..59e503c6040 100644 --- a/llvm/include/llvm/Analysis/ValueTracking.h +++ b/llvm/include/llvm/Analysis/ValueTracking.h @@ -436,16 +436,18 @@ template <typename T> class ArrayRef; /// E.g. if RangeMD is !{i32 0, i32 10, i32 15, i32 20} then return [0, 20). ConstantRange getConstantRangeFromMetadata(MDNode &RangeMD); - /// Return true if RHS is known to be implied by LHS. A & B must be i1 - /// (boolean) values or a vector of such values. Note that the truth table for - /// implication is the same as <=u on i1 values (but not <=s!). The truth - /// table for both is: + /// Return true if RHS is known to be implied by LHS. The implication may be + /// either true or false depending on what is returned in ImpliedTrue. + /// A & B must be i1 (boolean) values or a vector of such values. Note that + /// the truth table for implication is the same as <=u on i1 values (but not + /// <=s!). The truth table for both is: /// | T | F (B) /// T | T | F /// F | T | T /// (A) - bool isImpliedCondition(Value *LHS, Value *RHS, const DataLayout &DL, - unsigned Depth = 0, AssumptionCache *AC = nullptr, + bool isImpliedCondition(Value *LHS, Value *RHS, bool &ImpliedTrue, + const DataLayout &DL, unsigned Depth = 0, + AssumptionCache *AC = nullptr, const Instruction *CxtI = nullptr, const DominatorTree *DT = nullptr); } // end namespace llvm |