aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/GVN/rle.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-28 07:29:08 +0000
committerChris Lattner <sabre@nondot.org>2011-04-28 07:29:08 +0000
commit4034e14985af013f71f7884fa275415a3be27778 (patch)
tree1dce84546a8e65b2b9e6e3f2ec863eb41dc15984 /test/Transforms/GVN/rle.ll
parent8f232d307ace42180961856f69541b95b3278295 (diff)
downloadexternal_llvm-4034e14985af013f71f7884fa275415a3be27778.zip
external_llvm-4034e14985af013f71f7884fa275415a3be27778.tar.gz
external_llvm-4034e14985af013f71f7884fa275415a3be27778.tar.bz2
teach GVN to widen integer loads when they are overaligned, when doing an
wider load would allow elimination of subsequent loads, and when the wider load is still a native integer type. This eliminates a ton of loads on various benchmarks involving struct fields, though it is somewhat hobbled by clang not being very aggressive about field alignment. This is yet another step along the way towards resolving PR6627. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130390 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GVN/rle.ll')
-rw-r--r--test/Transforms/GVN/rle.ll25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll
index 11e207c..8f6e3b0 100644
--- a/test/Transforms/GVN/rle.ll
+++ b/test/Transforms/GVN/rle.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
; 32-bit little endian target.
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
;; Trivial RLE test.
define i32 @test0(i32 %V, i32* %P) {
@@ -593,4 +593,27 @@ if.end:
}
+;;===----------------------------------------------------------------------===;;
+;; Load Widening
+;;===----------------------------------------------------------------------===;;
+
+%widening1 = type { i32, i8, i8 }
+
+@f = global %widening1 zeroinitializer, align 4
+
+define i32 @test_widening1() nounwind ssp noredzone {
+entry:
+ %tmp = load i8* getelementptr inbounds (%widening1* @f, i64 0, i32 1), align 4
+ %conv = zext i8 %tmp to i32
+ %tmp1 = load i8* getelementptr inbounds (%widening1* @f, i64 0, i32 2), align 1
+ %conv2 = zext i8 %tmp1 to i32
+ %add = add nsw i32 %conv, %conv2
+ ret i32 %add
+; CHECK: @test_widening1
+; CHECK-NOT: load
+; CHECK: load i16*
+; CHECK-NOT: load
+; CHECK-ret i32
+}
+