summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-09-20 14:36:14 +0000
committerSanjay Patel <spatel@rotateright.com>2016-09-20 14:36:14 +0000
commitb2332e1931e311071d4f0b40fbb394333c5210e1 (patch)
tree0eaad4f62acae0aa9b7e1803018788d040c6f536 /llvm/lib/Analysis/InstructionSimplify.cpp
parentd1617cdc492adf585551db5e3881dffb00e3ee20 (diff)
downloadbcm5719-llvm-b2332e1931e311071d4f0b40fbb394333c5210e1.tar.gz
bcm5719-llvm-b2332e1931e311071d4f0b40fbb394333c5210e1.zip
move variables closer to their uses; add FIXMEs; NFC
llvm-svn: 281972
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 808674fc813..d42cad92e76 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1500,16 +1500,14 @@ static Value *simplifyUnsignedRangeCheck(ICmpInst *ZeroICmp,
}
static Value *SimplifyAndOfICmps(ICmpInst *Op0, ICmpInst *Op1) {
- Type *ITy = Op0->getType();
- ICmpInst::Predicate Pred0, Pred1;
- ConstantInt *CI1, *CI2;
- Value *V;
-
if (Value *X = simplifyUnsignedRangeCheck(Op0, Op1, /*IsAnd=*/true))
return X;
// Look for this pattern: (icmp V, C0) & (icmp V, C1)).
+ Type *ITy = Op0->getType();
+ ICmpInst::Predicate Pred0, Pred1;
const APInt *C0, *C1;
+ Value *V;
if (match(Op0, m_ICmp(Pred0, m_Value(V), m_APInt(C0))) &&
match(Op1, m_ICmp(Pred1, m_Specific(V), m_APInt(C1)))) {
// Make a constant range that's the intersection of the two icmp ranges.
@@ -1520,6 +1518,8 @@ static Value *SimplifyAndOfICmps(ICmpInst *Op0, ICmpInst *Op1) {
return getFalse(ITy);
}
+ // FIXME: Use m_APInt to allow vector splat matches.
+ ConstantInt *CI1, *CI2;
if (!match(Op0, m_ICmp(Pred0, m_Add(m_Value(V), m_ConstantInt(CI1)),
m_ConstantInt(CI2))))
return nullptr;
@@ -1685,16 +1685,16 @@ Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const DataLayout &DL,
/// Simplify (or (icmp ...) (icmp ...)) to true when we can tell that the union
/// contains all possible values.
static Value *SimplifyOrOfICmps(ICmpInst *Op0, ICmpInst *Op1) {
- ICmpInst::Predicate Pred0, Pred1;
- ConstantInt *CI1, *CI2;
- Value *V;
-
if (Value *X = simplifyUnsignedRangeCheck(Op0, Op1, /*IsAnd=*/false))
return X;
+ // FIXME: Use m_APInt to allow vector splat matches.
+ ICmpInst::Predicate Pred0, Pred1;
+ ConstantInt *CI1, *CI2;
+ Value *V;
if (!match(Op0, m_ICmp(Pred0, m_Add(m_Value(V), m_ConstantInt(CI1)),
m_ConstantInt(CI2))))
- return nullptr;
+ return nullptr;
if (!match(Op1, m_ICmp(Pred1, m_Specific(V), m_Specific(CI1))))
return nullptr;
OpenPOWER on IntegriCloud