forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use literal pool loads instead of MOVW/MOVT for materializing global …
…addresses when optimizing for size. On spec/gcc, this caused a codesize improvement of ~1.9% for ARM mode and ~4.9% for Thumb(2) mode. This is codesize including literal pools. The pools themselves doubled in size for ARM mode and quintupled for Thumb mode, leaving suggestion that there is still perhaps redundancy in LLVM's use of constant pools that could be decreased by sharing entries. Fixes PR11087. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142530 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
James Molloy
committed
Oct 19, 2011
1 parent
40230c4
commit cdd8e46
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; RUN: llc < %s -mtriple=armv7-apple-darwin | FileCheck %s | ||
; RUN: llc < %s -mtriple=armv7-unknown-linux-eabi | FileCheck %s | ||
|
||
; Check that when optimizing for size, a literal pool load is used | ||
; instead of the (potentially faster) movw/movt pair when loading | ||
; a large constant. | ||
|
||
@x = global i32* inttoptr (i32 305419888 to i32*), align 4 | ||
|
||
define i32 @f() optsize { | ||
; CHECK: f: | ||
; CHECK: ldr r{{.}}, {{.?}}LCPI{{.}}_{{.}} | ||
; CHECK: ldr r{{.}}, [{{(pc, )?}}r{{.}}] | ||
; CHECK: ldr r{{.}}, [r{{.}}] | ||
%1 = load i32** @x, align 4 | ||
%2 = load i32* %1 | ||
ret i32 %2 | ||
} | ||
|
||
define i32 @g() { | ||
; CHECK: g: | ||
; CHECK: movw | ||
; CHECK: movt | ||
%1 = load i32** @x, align 4 | ||
%2 = load i32* %1 | ||
ret i32 %2 | ||
} |