aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-01-19 22:53:50 +0000
committerDan Gohman <gohman@apple.com>2010-01-19 22:53:50 +0000
commit2b98bd23cb0bfa0dc09e1bcaef83a0e606e6ec1a (patch)
tree97f45bdbb889d34635172c0f6ea942f6e780325f /include
parentbbe2bbeac834dfe60fe98cfdeff9a9cc94858b7e (diff)
downloadexternal_llvm-2b98bd23cb0bfa0dc09e1bcaef83a0e606e6ec1a.zip
external_llvm-2b98bd23cb0bfa0dc09e1bcaef83a0e606e6ec1a.tar.gz
external_llvm-2b98bd23cb0bfa0dc09e1bcaef83a0e606e6ec1a.tar.bz2
Make SCEVAddRecExpr's getType return a pointer type when the add
has a pointer member. This helps reduce unnecessary bitcasting and uglygeps. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 2c50350..64b8b0b 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -295,6 +295,13 @@ namespace llvm {
public:
virtual const char *getOperationStr() const { return " + "; }
+ virtual const Type *getType() const {
+ // Use the type of the last operand, which is likely to be a pointer
+ // type, if there is one. This doesn't usually matter, but it can help
+ // reduce casts when the expressions are expanded.
+ return getOperand(getNumOperands() - 1)->getType();
+ }
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVAddExpr *S) { return true; }
static inline bool classof(const SCEV *S) {