[llvm-commits] [llvm] r93939 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolutionExpressions.h test/CodeGen/X86/pr3495.ll
Dan Gohman
gohman at apple.com
Tue Jan 19 14:53:50 PST 2010
Author: djg
Date: Tue Jan 19 16:53:50 2010
New Revision: 93939
URL: http://llvm.org/viewvc/llvm-project?rev=93939&view=rev
Log:
Make SCEVAddRecExpr's getType return a pointer type when the add
has a pointer member. This helps reduce unnecessary bitcasting
and uglygeps.
Modified:
llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
llvm/trunk/test/CodeGen/X86/pr3495.ll
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=93939&r1=93938&r2=93939&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Tue Jan 19 16:53:50 2010
@@ -295,6 +295,13 @@
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) {
Modified: llvm/trunk/test/CodeGen/X86/pr3495.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr3495.ll?rev=93939&r1=93938&r2=93939&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr3495.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pr3495.ll Tue Jan 19 16:53:50 2010
@@ -1,6 +1,6 @@
-; RUN: llc < %s -march=x86 -stats |& grep {Number of reloads omited} | grep 1
-; RUN: llc < %s -march=x86 -stats |& grep {Number of available reloads turned into copies} | grep 1
-; RUN: llc < %s -march=x86 -stats |& grep {Number of machine instrs printed} | grep 40
+; RUN: llc < %s -march=x86 -stats |& grep {Number of loads added} | grep 2
+; RUN: llc < %s -march=x86 -stats |& grep {Number of register spills} | grep 1
+; RUN: llc < %s -march=x86 -stats |& grep {Number of machine instrs printed} | grep 38
; PR3495
; The loop reversal kicks in once here, resulting in one fewer instruction.
More information about the llvm-commits
mailing list