diff options
| author | Dan Gohman <gohman@apple.com> | 2009-06-22 15:03:27 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-06-22 15:03:27 +0000 |
| commit | 2bc22305d2eac43ac37519bdfd82b34b745dfc69 (patch) | |
| tree | f2c1de3f84a4d43fe0a766ab86ef70c5735327eb /llvm/lib/Analysis | |
| parent | 8077d7eb153f936f67532b8644aac90cd2aa4a80 (diff) | |
| download | bcm5719-llvm-2bc22305d2eac43ac37519bdfd82b34b745dfc69.tar.gz bcm5719-llvm-2bc22305d2eac43ac37519bdfd82b34b745dfc69.zip | |
Add a getUMinFromMismatchedTypes helper function.
llvm-svn: 73883
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 68aa595aa8d..d67761c60a3 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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. |

