[llvm-commits] [llvm] r46372 - /llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c

Chris Lattner sabre at nondot.org
Fri Jan 25 14:36:25 PST 2008


Author: lattner
Date: Fri Jan 25 16:36:24 2008
New Revision: 46372

URL: http://llvm.org/viewvc/llvm-project?rev=46372&view=rev
Log:
add a testcase for a bug Duncan pointed out.

Added:
    llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c

Added: llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c?rev=46372&view=auto

==============================================================================
--- llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c (added)
+++ llvm/trunk/test/CFrontend/2008-01-25-ByValReadNone.c Fri Jan 25 16:36:24 2008
@@ -0,0 +1,10 @@
+// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep readonly
+// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | not grep readnone
+
+
+// The struct being passed byval means that we need to mark the 
+// function readonly instead of readnone.  Readnone would allow
+// stores to the arg to be deleted in the caller.
+struct S { int A[1000]; };
+int __attribute__ ((const)) f(struct S x) { return x.A[0]; }
+





More information about the llvm-commits mailing list