summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-09 17:00:45 +0000
committerChris Lattner <sabre@nondot.org>2011-02-09 17:00:45 +0000
commitaeaf3d484b4d4c35e8794378c4b6cfbbde718dd1 (patch)
tree4d27812ae07d87c3fb7a1fa51aa2582428764ce2 /lib
parent1aac1864cfb66ae3d322ff7e28738d03bc1d1bfc (diff)
downloadllvm-aeaf3d484b4d4c35e8794378c4b6cfbbde718dd1.tar.gz
llvm-aeaf3d484b4d4c35e8794378c4b6cfbbde718dd1.tar.bz2
llvm-aeaf3d484b4d4c35e8794378c4b6cfbbde718dd1.tar.xz
Rework InstrTypes.h so to reduce the repetition around the NSW/NUW/Exact
versions of creation functions. Eventually, the "insertion point" versions of these should just be removed, we do have IRBuilder afterall. Do a massive rewrite of much of pattern match. It is now shorter and less redundant and has several other widgets I will be using in other patches. Among other changes, m_Div is renamed to m_IDiv (since it only matches integer divides) and m_Shift is gone (it used to match all binops!!) and we now have m_LogicalShift for the one client to use. Enhance IRBuilder to have "isExact" arguments to things like CreateUDiv and reduce redundancy within IRbuilder by having these methods chain to each other more instead of duplicating code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125194 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/InstructionSimplify.cpp4
-rw-r--r--lib/Transforms/InstCombine/InstCombineAndOrXor.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index 2b217e1446..20489b4dca 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -734,8 +734,8 @@ static Value *SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD,
// (X / Y) * Y -> X if the division is exact.
Value *X = 0, *Y = 0;
- if ((match(Op0, m_Div(m_Value(X), m_Value(Y))) && Y == Op1) || // (X / Y) * Y
- (match(Op1, m_Div(m_Value(X), m_Value(Y))) && Y == Op0)) { // Y * (X / Y)
+ if ((match(Op0, m_IDiv(m_Value(X), m_Value(Y))) && Y == Op1) || // (X / Y) * Y
+ (match(Op1, m_IDiv(m_Value(X), m_Value(Y))) && Y == Op0)) { // Y * (X / Y)
BinaryOperator *Div = cast<BinaryOperator>(Y == Op1 ? Op0 : Op1);
if (Div->isExact())
return X;
diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index e6318e9bc8..4c6c1beaa5 100644
--- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -1755,8 +1755,8 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
// (A >> B) | (C << D) and (A << B) | (B >> C) -> bswap if possible.
if (match(Op0, m_Or(m_Value(), m_Value())) ||
match(Op1, m_Or(m_Value(), m_Value())) ||
- (match(Op0, m_Shift(m_Value(), m_Value())) &&
- match(Op1, m_Shift(m_Value(), m_Value())))) {
+ (match(Op0, m_LogicalShift(m_Value(), m_Value())) &&
+ match(Op1, m_LogicalShift(m_Value(), m_Value())))) {
if (Instruction *BSwap = MatchBSwap(I))
return BSwap;
}