summaryrefslogtreecommitdiff
path: root/test/Transforms/ScalarRepl
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-11-04 14:43:57 +0000
committerDuncan Sands <baldrick@free.fr>2007-11-04 14:43:57 +0000
commit3cb3650a278e37aa6378127c51e407d2823139b4 (patch)
tree436b92ec7ba9208e6565d125d716e194cfdc80f8 /test/Transforms/ScalarRepl
parent9aeaf7593bb3c124aa8a5aa9623efcf3db3b0534 (diff)
downloadllvm-3cb3650a278e37aa6378127c51e407d2823139b4.tar.gz
llvm-3cb3650a278e37aa6378127c51e407d2823139b4.tar.bz2
llvm-3cb3650a278e37aa6378127c51e407d2823139b4.tar.xz
Change uses of getTypeSize to getABITypeSize, getTypeStoreSize
or getTypeSizeInBits as appropriate in ScalarReplAggregates. The right change to make was not always obvious, so it would be good to have an sroa guru review this. While there I noticed some bugs, and fixed them: (1) arrays of x86 long double have holes due to alignment padding, but this wasn't being spotted by HasStructPadding (renamed to HasPadding). The same goes for arrays of oddly sized ints. Vectors also suffer from this, in fact the problem for vectors is much worse because basic vector assumptions seem to be broken by vectors of type with alignment padding. I didn't try to fix any of these vector problems. (2) The code for extracting smaller integers from larger ones (in the "int union" case) was wrong on big-endian machines for integers with size not a multiple of 8, like i1. Probably this is impossible to hit via llvm-gcc, but I fixed it anyway while there and added a testcase. I also got rid of some trailing whitespace and changed a function name which had an obvious typo in it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43672 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ScalarRepl')
-rw-r--r--test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll b/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll
new file mode 100644
index 0000000000..d2d2b24da7
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep shr
+
+%struct.S = type { i16 }
+
+define i1 @f(i16 signext %b) zeroext {
+entry:
+ %b_addr = alloca i16 ; <i16*> [#uses=2]
+ %retval = alloca i32 ; <i32*> [#uses=2]
+ %s = alloca %struct.S ; <%struct.S*> [#uses=2]
+ %tmp = alloca i32 ; <i32*> [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
+ store i16 %b, i16* %b_addr
+ %tmp1 = getelementptr %struct.S* %s, i32 0, i32 0 ; <i16*> [#uses=1]
+ %tmp2 = load i16* %b_addr, align 2 ; <i16> [#uses=1]
+ store i16 %tmp2, i16* %tmp1, align 2
+ %tmp3 = getelementptr %struct.S* %s, i32 0, i32 0 ; <i16*> [#uses=1]
+ %tmp34 = bitcast i16* %tmp3 to [2 x i1]* ; <[2 x i1]*> [#uses=1]
+ %tmp5 = getelementptr [2 x i1]* %tmp34, i32 0, i32 1 ; <i1*> [#uses=1]
+ %tmp6 = load i1* %tmp5, align 1 ; <i1> [#uses=1]
+ %tmp67 = zext i1 %tmp6 to i32 ; <i32> [#uses=1]
+ store i32 %tmp67, i32* %tmp, align 4
+ %tmp8 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ store i32 %tmp8, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval9 = load i32* %retval ; <i32> [#uses=1]
+ %retval910 = trunc i32 %retval9 to i1 ; <i1> [#uses=1]
+ ret i1 %retval910
+}