aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-22 15:03:27 +0000
committerDan Gohman <gohman@apple.com>2009-06-22 15:03:27 +0000
commit9e62bb045dc728b995d2d30ba85b3e84693bd5bd (patch)
treec76609130e9598d6c1dc76ffd5b44d4340d59ae3 /lib/Analysis
parent6419491714485fe43685ea97dcc7ef83a872cbe8 (diff)
downloadexternal_llvm-9e62bb045dc728b995d2d30ba85b3e84693bd5bd.zip
external_llvm-9e62bb045dc728b995d2d30ba85b3e84693bd5bd.tar.gz
external_llvm-9e62bb045dc728b995d2d30ba85b3e84693bd5bd.tar.bz2
Add a getUMinFromMismatchedTypes helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73883 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 68aa595..d67761c 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2156,6 +2156,22 @@ SCEVHandle ScalarEvolution::getUMaxFromMismatchedTypes(const SCEVHandle &LHS,
return getUMaxExpr(PromotedLHS, PromotedRHS);
}
+/// getUMinFromMismatchedTypes - Promote the operands to the wider of
+/// the types using zero-extension, and then perform a umin operation
+/// with them.
+SCEVHandle ScalarEvolution::getUMinFromMismatchedTypes(const SCEVHandle &LHS,
+ const SCEVHandle &RHS) {
+ SCEVHandle PromotedLHS = LHS;
+ SCEVHandle PromotedRHS = RHS;
+
+ if (getTypeSizeInBits(LHS->getType()) > getTypeSizeInBits(RHS->getType()))
+ PromotedRHS = getZeroExtendExpr(RHS, LHS->getType());
+ else
+ PromotedLHS = getNoopOrZeroExtend(LHS, RHS->getType());
+
+ return getUMinExpr(PromotedLHS, PromotedRHS);
+}
+
/// ReplaceSymbolicValueWithConcrete - This looks up the computed SCEV value for
/// the specified instruction and replaces any references to the symbolic value
/// SymName with the specified value. This is used during PHI resolution.