summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2018-07-06 04:04:13 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2018-07-06 04:04:13 +0000
commit20da7e467aff1949397a8d3ff56eb5df8424e0c8 (patch)
tree1b85065f055e0ae23ed382ed176a3b86b28ce59b /llvm/lib/Transforms
parent7b35585ff13d833e4736f8169c9ea200dd011aeb (diff)
downloadbcm5719-llvm-20da7e467aff1949397a8d3ff56eb5df8424e0c8.tar.gz
bcm5719-llvm-20da7e467aff1949397a8d3ff56eb5df8424e0c8.zip
Revert "[InstCombine] Delay foldICmpUsingKnownBits until simple transforms are done"
llvm-svn: 336410
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 41e4124d686..d52ea2cf6eb 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -4485,6 +4485,9 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
if (Instruction *Res = foldICmpWithConstant(I))
return Res;
+ if (Instruction *Res = foldICmpUsingKnownBits(I))
+ return Res;
+
// Test if the ICmpInst instruction is used exclusively by a select as
// part of a minimum or maximum operation. If so, refrain from doing
// any other folding. This helps out other analyses which understand
@@ -4703,13 +4706,6 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
if (match(Op1, m_Add(m_Value(X), m_ConstantInt(Cst))) && Op0 == X)
return foldICmpAddOpConst(X, Cst, I.getSwappedPredicate());
}
-
- // This may be expensive in compile-time, and transforms based on known bits
- // can make further analysis more difficult, so we use it as the last resort
- // if we cannot do anything better.
- if (Instruction *Res = foldICmpUsingKnownBits(I))
- return Res;
-
return Changed ? &I : nullptr;
}
OpenPOWER on IntegriCloud