diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-09-05 02:18:34 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-09-05 02:18:34 +0000 | 
| commit | beac75da3784929aee9f0357fc5cd76d49d6c3d7 (patch) | |
| tree | 54525601bcdb388c49b9d014c90e6cbe8dbc1467 /docs/CommandGuide/llvmc.pod | |
| parent | 07c2b7ff685523458f92339facfd814689e55873 (diff) | |
implement rdar://6653118 - fastisel should fold loads where possible.
Since mem2reg isn't run at -O0, we get a ton of reloads from the stack,
for example, before, this code:
int foo(int x, int y, int z) {
  return x+y+z;
}
used to compile into:
_foo:                                   ## @foo
	subq	$12, %rsp
	movl	%edi, 8(%rsp)
	movl	%esi, 4(%rsp)
	movl	%edx, (%rsp)
	movl	8(%rsp), %edx
	movl	4(%rsp), %esi
	addl	%edx, %esi
	movl	(%rsp), %edx
	addl	%esi, %edx
	movl	%edx, %eax
	addq	$12, %rsp
	ret
Now we produce:
_foo:                                   ## @foo
	subq	$12, %rsp
	movl	%edi, 8(%rsp)
	movl	%esi, 4(%rsp)
	movl	%edx, (%rsp)
	movl	8(%rsp), %edx
	addl	4(%rsp), %edx    ## Folded load
	addl	(%rsp), %edx     ## Folded load
	movl	%edx, %eax
	addq	$12, %rsp
	ret
Fewer instructions and less register use = faster compiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/CommandGuide/llvmc.pod')
0 files changed, 0 insertions, 0 deletions
