diff options
author | Dan Gohman <sunfish@mozilla.com> | 2014-02-28 12:39:49 -0800 |
---|---|---|
committer | Dan Gohman <sunfish@mozilla.com> | 2014-02-28 12:39:49 -0800 |
commit | dc59054db06864099c1b1051b8ef28a30f13e6c7 (patch) | |
tree | b666500aa3d0eb8e03379f55a43a6391c32ded29 /test | |
parent | 3ef11173bf12b5fdc0a21bfd883b057718676e8f (diff) |
Use range metadata instead of introducing selects.
When GlobalOpt has determined that a GlobalVariable only ever has two values,
it would convert the GlobalVariable to a boolean, and introduce SelectInsts
at every load, to choose between the two possible values. These SelectInsts
introduce overhead and other unpleasantness.
This patch makes GlobalOpt just add range metadata to loads from such
GlobalVariables instead. This enables the same main optimization (as seen in
test/Transforms/GlobalOpt/integer-bool.ll), without introducing selects.
The main downside is that it doesn't get the memory savings of shrinking such
GlobalVariables, but this is expected to be negligible.
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/GlobalOpt/integer-bool.ll | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/Transforms/GlobalOpt/integer-bool.ll b/test/Transforms/GlobalOpt/integer-bool.ll index 51858069ac..b1316cd212 100644 --- a/test/Transforms/GlobalOpt/integer-bool.ll +++ b/test/Transforms/GlobalOpt/integer-bool.ll @@ -4,17 +4,17 @@ @G = internal addrspace(1) global i32 0 ; CHECK: @G ; CHECK: addrspace(1) -; CHECK: global i1 false +; CHECK: global i32 0 define void @set1() { store i32 0, i32 addrspace(1)* @G -; CHECK: store i1 false +; CHECK: store i32 0 ret void } define void @set2() { store i32 1, i32 addrspace(1)* @G -; CHECK: store i1 true +; CHECK: store i32 1 ret void } |