summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/InstCombine/InstCombineCompares.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-09-06 18:34:38 +0000
committerdim <dim@FreeBSD.org>2015-09-06 18:34:38 +0000
commit9fcebda97d0cb3d7a2235d2ad835c3a2679e7683 (patch)
tree461d3cf041290f4a99740d540bf0973d6084f98e /lib/Transforms/InstCombine/InstCombineCompares.cpp
parentc5dd590220d0afe971d065bfe9324f549dd00968 (diff)
downloadFreeBSD-src-9fcebda97d0cb3d7a2235d2ad835c3a2679e7683.zip
FreeBSD-src-9fcebda97d0cb3d7a2235d2ad835c3a2679e7683.tar.gz
Import llvm 3.7.0 release (r246257).
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCompares.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 0bd6fd2..95bba3c 100644
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2112,9 +2112,8 @@ static Instruction *ProcessUGT_ADDCST_ADD(ICmpInst &I, Value *A, Value *B,
bool InstCombiner::OptimizeOverflowCheck(OverflowCheckFlavor OCF, Value *LHS,
Value *RHS, Instruction &OrigI,
Value *&Result, Constant *&Overflow) {
- assert((!OrigI.isCommutative() ||
- !(isa<Constant>(LHS) && !isa<Constant>(RHS))) &&
- "call with a constant RHS if possible!");
+ if (OrigI.isCommutative() && isa<Constant>(LHS) && !isa<Constant>(RHS))
+ std::swap(LHS, RHS);
auto SetResult = [&](Value *OpResult, Constant *OverflowVal, bool ReuseName) {
Result = OpResult;
OpenPOWER on IntegriCloud