llvm-project/clang/lib
Chris Lattner 3fcc790cd8 Change IR generation for return (in the simple case) to avoid doing silly
load/store nonsense in the epilog.  For example, for:

int foo(int X) {
  int A[100];
  return A[X];
}

we used to generate:

  %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
  %tmp1 = load i32* %arrayidx                     ; <i32> [#uses=1]
  store i32 %tmp1, i32* %retval
  %0 = load i32* %retval                          ; <i32> [#uses=1]
  ret i32 %0
}

which codegen'd to this code:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	subq	$408, %rsp              ## imm = 0x198
	movl	%edi, 400(%rsp)
	movl	400(%rsp), %edi
	movslq	%edi, %rax
	movl	(%rsp,%rax,4), %edi
	movl	%edi, 404(%rsp)
	movl	404(%rsp), %eax
	addq	$408, %rsp              ## imm = 0x198
	ret

Now we generate:

  %arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
  %tmp1 = load i32* %arrayidx                     ; <i32> [#uses=1]
  ret i32 %tmp1
}

and:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	subq	$408, %rsp              ## imm = 0x198
	movl	%edi, 404(%rsp)
	movl	404(%rsp), %edi
	movslq	%edi, %rax
	movl	(%rsp,%rax,4), %eax
	addq	$408, %rsp              ## imm = 0x198
	ret

This actually does matter, cutting out 2000 lines of IR from CGStmt.ll 
for example.

Another interesting effect is that altivec.h functions which are dead
now get dce'd by the inliner.  Hence all the changes to 
builtins-ppc-altivec.c to ensure the calls aren't dead.

llvm-svn: 106970
2010-06-27 01:06:27 +00:00
..
AST Support UnresolvedLookupExpr for PCH. 2010-06-25 09:03:34 +00:00
Analysis Type Type::isRealFloatingType() that vectors are not floating-point 2010-06-22 23:07:26 +00:00
Basic Translate numbers properly. 2010-06-25 19:04:52 +00:00
Checker Allow '__extension__' to be analyzed in a lvalue context. 2010-06-26 22:40:52 +00:00
CodeGen Change IR generation for return (in the simple case) to avoid doing silly 2010-06-27 01:06:27 +00:00
Driver Implement support for -fwrapv, rdar://7221421 2010-06-26 21:25:03 +00:00
Frontend Implement support for -fwrapv, rdar://7221421 2010-06-26 21:25:03 +00:00
Headers Add a missing dependency to try to fix a buildbot failure. 2010-06-26 00:03:23 +00:00
Index Simplify libIndex Makefile, which doesn't need to worry about altivec support. 2010-06-08 20:57:18 +00:00
Lex Implement support for #pragma message, patch by Michael Spencer! 2010-06-26 17:11:39 +00:00
Parse Add parentheses suggested by gcc. 2010-06-23 19:34:52 +00:00
Rewrite introduce a new CharSourceRange class, and enhance the diagnostics routines 2010-06-18 22:45:06 +00:00
Runtime build: Get CLANG_VERSION from Version.inc instead of depending on VER file directly. 2010-06-25 17:33:49 +00:00
Sema Use TypeSourceInfo to help determine the SourceRange of a CXXNewExpr. This fixes several 2010-06-25 22:48:49 +00:00
CMakeLists.txt Split libAnalysis into two libraries: libAnalysis and libChecker. 2010-01-25 04:41:41 +00:00
Makefile Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile. 2010-06-08 20:34:18 +00:00