diff mbox series

[06/17] add test for dereference cost of symbol with complex type

Message ID 20191210225921.94897-7-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series improve expansion of constant symbols | expand

Commit Message

Luc Van Oostenryck Dec. 10, 2019, 10:59 p.m. UTC
Currently, in expand_dereference(), the dereference of a symbol with
a complex type is considered as costing as high as a non-symbol
because it's not recognised it's a symbol.

Add a testcase for this.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 validation/expand/cost-deref-nested.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 validation/expand/cost-deref-nested.c
diff mbox series

Patch

diff --git a/validation/expand/cost-deref-nested.c b/validation/expand/cost-deref-nested.c
new file mode 100644
index 000000000000..b09602b6acc6
--- /dev/null
+++ b/validation/expand/cost-deref-nested.c
@@ -0,0 +1,21 @@ 
+struct s {
+	struct {
+		int u, v;
+	} a, b;
+};
+
+static const struct s s;
+
+static int foo(int c)
+{
+	return c && s.b.v;
+}
+
+/*
+ * check-name: cost-deref-nested
+ * check-command: test-linearize -fdump-ir $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: cbr
+ */