summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/24-bit.c
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2014-08-29 10:17:52 +0000
committerJames Molloy <james.molloy@arm.com>2014-08-29 10:17:52 +0000
commit90d61014100115bfd3489f8d73b46fbb54963c41 (patch)
tree499918bbf572741b1de508ecbcf4af9bc30585ed /clang/test/CodeGen/24-bit.c
parent6afbf2aa5ea13e26903b965bb79e43705b71eb26 (diff)
downloadbcm5719-llvm-90d61014100115bfd3489f8d73b46fbb54963c41.tar.gz
bcm5719-llvm-90d61014100115bfd3489f8d73b46fbb54963c41.zip
Use store size instead of alloc size when coercing.
Previously, EnterStructPointerForCoercedAccess used Alloc size when determining how to convert. This was problematic, because there were situations were the alloc size was larger than the store size. For example, if the first element of a structure were i24 and the destination type were i32, the old code would generate a GEP and a load i24. The code should compare store sizes to ensure the whole object is loaded. I have attached a test case. This patch modifies the output of arm64-be-bitfield.c test case, but the new IR seems to be equivalent, and after -O3, the compiler generates identical ARM assembly. (asr x0, x0, #54) Patch by Thomas Jablin! llvm-svn: 216722
Diffstat (limited to 'clang/test/CodeGen/24-bit.c')
-rw-r--r--clang/test/CodeGen/24-bit.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/CodeGen/24-bit.c b/clang/test/CodeGen/24-bit.c
new file mode 100644
index 00000000000..9dd0157fd3b
--- /dev/null
+++ b/clang/test/CodeGen/24-bit.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -O0 -o - %s | FileCheck %s
+
+static union ibtt2
+{
+ struct ibtt0 { signed ibt0:10; unsigned short ibt1; } ibt5;
+ struct ibtt1 { signed ibt2:3; signed ibt3:9; signed ibt4:9; } ibt6;
+} ibt15 = {{267, 15266}};
+
+void callee_ibt0f(union ibtt2 ibtp5);
+
+void test(void) {
+// CHECK: = load i32*
+ callee_ibt0f(ibt15);
+}
OpenPOWER on IntegriCloud