diff options
author | Manman Ren <manman.ren@gmail.com> | 2013-10-07 19:47:53 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2013-10-07 19:47:53 +0000 |
commit | fb92f4645968724d2095ef95a7034d7e20d39b3f (patch) | |
tree | b7bd9c3c111dd3ec500bfecf292dbd551abacc74 /test/CodeGen/ARM | |
parent | 116189a997a71d0e63db64ef4c6c3906078d94cf (diff) | |
download | llvm-fb92f4645968724d2095ef95a7034d7e20d39b3f.tar.gz llvm-fb92f4645968724d2095ef95a7034d7e20d39b3f.tar.bz2 llvm-fb92f4645968724d2095ef95a7034d7e20d39b3f.tar.xz |
Struct byval: use the correct alignment for loads generated to load
from struct byval to registers.
We used to pass 0 which means the alignment of PtrVT. Even when the alignment
of the struct is smaller than 4, the LOADs would have alignment of 4, and
further optimizations could combine the LOADs into a ldm, which would
cause crash.
The fix is to pass the alignment of the struct byval.
rdar://problem/15144402
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM')
-rw-r--r-- | test/CodeGen/ARM/byval_load_align.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGen/ARM/byval_load_align.ll b/test/CodeGen/ARM/byval_load_align.ll new file mode 100644 index 0000000000..2c0910c71d --- /dev/null +++ b/test/CodeGen/ARM/byval_load_align.ll @@ -0,0 +1,27 @@ +; RUN: llc < %s -mtriple thumbv7-apple-ios -O1 | FileCheck %s + +; rdar://15144402 +; Make sure we don't assume 4-byte alignment when loading from a byval argument +; with alignment of 2. +; CHECK: ldr r1, [r[[REG:[0-9]+]]] +; CHECK: ldr r2, [r[[REG]], #4] +; CHECK: ldr r3, [r[[REG]], #8] +; CHECK-NOT: ldm +; CHECK: .align 1 @ @sID + +%struct.ModuleID = type { [32 x i8], [32 x i8], i16 } + +@sID = internal constant %struct.ModuleID { [32 x i8] c"TEST\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [32 x i8] c"1.0\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i16 23 }, align 2 + +; Function Attrs: nounwind ssp +define void @Client() #0 { +entry: + tail call void @Logger(i8 signext 97, %struct.ModuleID* byval @sID) #2 + ret void +} + +declare void @Logger(i8 signext, %struct.ModuleID* byval) #1 + +attributes #0 = { nounwind ssp "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind } |