aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/mem2reg/short-load.c
diff options
Diffstat (limited to 'validation/mem2reg/short-load.c')
-rw-r--r--validation/mem2reg/short-load.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/validation/mem2reg/short-load.c b/validation/mem2reg/short-load.c
new file mode 100644
index 00000000..c4b4dc4b
--- /dev/null
+++ b/validation/mem2reg/short-load.c
@@ -0,0 +1,29 @@
+#ifdef __SIZEOF_INT__ == 4
+typedef unsigned int u32;
+#endif
+#ifdef __SIZEOF_SHORT__ == 2
+typedef unsigned short u16;
+#endif
+
+
+union u {
+ u32 a;
+ u16 b;
+};
+
+void bar(u16, union u);
+
+void foo(u16 val)
+{
+ union u u;
+
+ u.b = val;
+ bar(u.b, u);
+}
+
+/*
+ * check-name: short-load
+ * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
+ * check-output-ignore
+ * check-output-contains: load\\.32
+ */