[cfe-commits] r101877 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGen/arm-arguments.c test/CodeGen/blocks.c test/CodeGen/struct-passing.c test/CodeGen/x86_32-arguments.c test/CodeGen/x86_64-arguments.c test/CodeGenCXX/x86_32-arguments.cpp test/CodeGenObjC/x86_64-struct-return-gc.m

Chris Lattner sabre at nondot.org
Mon Apr 19 22:44:43 PDT 2010


Author: lattner
Date: Tue Apr 20 00:44:43 2010
New Revision: 101877

URL: http://llvm.org/viewvc/llvm-project?rev=101877&view=rev
Log:
don't slap noalias attribute on stret result arguments.
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525.  There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/test/CodeGen/arm-arguments.c
    cfe/trunk/test/CodeGen/blocks.c
    cfe/trunk/test/CodeGen/struct-passing.c
    cfe/trunk/test/CodeGen/x86_32-arguments.c
    cfe/trunk/test/CodeGen/x86_64-arguments.c
    cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp
    cfe/trunk/test/CodeGenObjC/x86_64-struct-return-gc.m

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Apr 20 00:44:43 2010
@@ -586,8 +586,7 @@
 
   case ABIArgInfo::Indirect:
     PAL.push_back(llvm::AttributeWithIndex::get(Index,
-                                                llvm::Attribute::StructRet |
-                                                llvm::Attribute::NoAlias));
+                                                llvm::Attribute::StructRet));
     ++Index;
     // sret disables readnone and readonly
     FuncAttrs &= ~(llvm::Attribute::ReadOnly |

Modified: cfe/trunk/test/CodeGen/arm-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-arguments.c?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm-arguments.c (original)
+++ cfe/trunk/test/CodeGen/arm-arguments.c Tue Apr 20 00:44:43 2010
@@ -28,13 +28,13 @@
 struct s4 f4(void) {}
 
 // APCS-GNU: define arm_apcscc void @f5(
-// APCS-GNU: struct.s5* noalias sret
+// APCS-GNU: struct.s5* sret
 // AAPCS: define arm_aapcscc i32 @f5()
 struct s5 { struct { } f0; int f1; };
 struct s5 f5(void) {}
 
 // APCS-GNU: define arm_apcscc void @f6(
-// APCS-GNU: struct.s6* noalias sret
+// APCS-GNU: struct.s6* sret
 // AAPCS: define arm_aapcscc i32 @f6()
 struct s6 { int f0[1]; };
 struct s6 f6(void) {}
@@ -45,7 +45,7 @@
 struct s7 f7(void) {}
 
 // APCS-GNU: define arm_apcscc void @f8(
-// APCS-GNU: struct.s8* noalias sret
+// APCS-GNU: struct.s8* sret
 // AAPCS: define arm_aapcscc void @f8()
 struct s8 { struct { int : 0; } f0[1]; };
 struct s8 f8(void) {}
@@ -61,7 +61,7 @@
 struct s10 f10(void) {}
 
 // APCS-GNU: define arm_apcscc void @f11(
-// APCS-GNU: struct.s10* noalias sret
+// APCS-GNU: struct.s10* sret
 // AAPCS: define arm_aapcscc i32 @f11()
 struct s11 { int : 0; int f0; };
 struct s11 f11(void) {}
@@ -72,7 +72,7 @@
 union u12 f12(void) {}
 
 // APCS-GNU: define arm_apcscc void @f13(
-// APCS-GNU: struct.s13* noalias sret
+// APCS-GNU: struct.s13* sret
 
 // FIXME: This should return a float.
 // AAPCS-FIXME: define arm_aapcscc float @f13()
@@ -80,7 +80,7 @@
 struct s13 f13(void) {}
 
 // APCS-GNU: define arm_apcscc void @f14(
-// APCS-GNU: struct.s13* noalias sret
+// APCS-GNU: struct.s13* sret
 // AAPCS: define arm_aapcscc i32 @f14()
 union u14 { float f0; };
 union u14 f14(void) {}
@@ -104,13 +104,13 @@
 struct s18 f18(void) {}
 
 // APCS-GNU: define arm_apcscc void @f19(
-// APCS-GNU: struct.s19* noalias sret
+// APCS-GNU: struct.s19* sret
 // AAPCS: define arm_aapcscc i32 @f19()
 struct s19 { int f0; struct s8 f1; };
 struct s19 f19(void) {}
 
 // APCS-GNU: define arm_apcscc void @f20(
-// APCS-GNU: struct.s20* noalias sret
+// APCS-GNU: struct.s20* sret
 // AAPCS: define arm_aapcscc i32 @f20()
 struct s20 { struct s8 f1; int f0; };
 struct s20 f20(void) {}
@@ -128,10 +128,10 @@
 // APCS-GNU: define arm_apcscc i128 @f27()
 // AAPCS: define arm_aapcscc i16 @f22()
 // AAPCS: define arm_aapcscc i32 @f23()
-// AAPCS: define arm_aapcscc void @f24({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f25({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f26({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f27({{.*}} noalias sret
+// AAPCS: define arm_aapcscc void @f24({{.*}} sret
+// AAPCS: define arm_aapcscc void @f25({{.*}} sret
+// AAPCS: define arm_aapcscc void @f26({{.*}} sret
+// AAPCS: define arm_aapcscc void @f27({{.*}} sret
 _Complex char       f22(void) {}
 _Complex short      f23(void) {}
 _Complex int        f24(void) {}
@@ -149,7 +149,7 @@
 struct s29 { _Complex short f0; };
 struct s29 f29() {}
 
-// APCS-GNU: define arm_apcscc void @f30({{.*}} noalias sret
-// AAPCS: define arm_aapcscc void @f30({{.*}} noalias sret
+// APCS-GNU: define arm_apcscc void @f30({{.*}} sret
+// AAPCS: define arm_aapcscc void @f30({{.*}} sret
 struct s30 { _Complex int f0; };
 struct s30 f30() {}

Modified: cfe/trunk/test/CodeGen/blocks.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/blocks.c?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/blocks.c (original)
+++ cfe/trunk/test/CodeGen/blocks.c Tue Apr 20 00:44:43 2010
@@ -12,7 +12,7 @@
   int a[64];
 };
 
-// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* noalias sret .*, .*, .* byval .*)' %t
+// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* sret .*, .*, .* byval .*)' %t
 struct s0 f2(struct s0 a0) {
   return ^(struct s0 a1){ return a1; }(a0);
 }

Modified: cfe/trunk/test/CodeGen/struct-passing.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct-passing.c?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/struct-passing.c (original)
+++ cfe/trunk/test/CodeGen/struct-passing.c Tue Apr 20 00:44:43 2010
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
 // RUN: grep 'declare i32 @f0() readnone$' %t
 // RUN: grep 'declare i32 @f1() readonly$' %t
-// RUN: grep 'declare void @f2(.* noalias sret)$' %t
-// RUN: grep 'declare void @f3(.* noalias sret)$' %t
+// RUN: grep 'declare void @f2(.* sret)$' %t
+// RUN: grep 'declare void @f3(.* sret)$' %t
 // RUN: grep 'declare void @f4(.* byval)$' %t
 // RUN: grep 'declare void @f5(.* byval)$' %t
 // PR3835

Modified: cfe/trunk/test/CodeGen/x86_32-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments.c?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments.c Tue Apr 20 00:44:43 2010
@@ -72,7 +72,7 @@
 // Small vectors and 1 x {i64,double} are returned in registers
 
 // RUN: grep 'i32 @f11()' %t
-// RUN: grep -F 'void @f12(<2 x i32>* noalias sret %agg.result)' %t
+// RUN: grep -F 'void @f12(<2 x i32>* sret %agg.result)' %t
 // RUN: grep 'i64 @f13()' %t
 // RUN: grep 'i64 @f14()' %t
 // RUN: grep '<2 x i64> @f15()' %t
@@ -94,11 +94,11 @@
 // 128-bits).
 
 // RUN: grep 'i32 @f17()' %t
-// RUN: grep -F 'void @f18(%2* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f19(%3* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f20(%4* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f21(%5* noalias sret %agg.result)' %t
-// RUN: grep -F 'void @f22(%6* noalias sret %agg.result)' %t
+// RUN: grep -F 'void @f18(%2* sret %agg.result)' %t
+// RUN: grep -F 'void @f19(%3* sret %agg.result)' %t
+// RUN: grep -F 'void @f20(%4* sret %agg.result)' %t
+// RUN: grep -F 'void @f21(%5* sret %agg.result)' %t
+// RUN: grep -F 'void @f22(%6* sret %agg.result)' %t
 struct { T11 a; } f17(void) { while (1) {} }
 struct { T12 a; } f18(void) { while (1) {} }
 struct { T13 a; } f19(void) { while (1) {} }
@@ -117,11 +117,11 @@
 
 // Small structures are handled recursively
 // RUN: grep -F 'i32 @f26()' %t
-// RUN: grep 'void @f27(%.truct.s27\* noalias sret %agg.result)' %t
+// RUN: grep 'void @f27(%.truct.s27\* sret %agg.result)' %t
 struct s26 { struct { char a, b; } a; struct { char a, b; } b; } f26(void) { while (1) {} }
 struct s27 { struct { char a, b, c; } a; struct { char a; } b; } f27(void) { while (1) {} }
 
-// RUN: grep 'void @f28(%.truct.s28\* noalias sret %agg.result)' %t
+// RUN: grep 'void @f28(%.truct.s28\* sret %agg.result)' %t
 struct s28 { int a; int b[]; } f28(void) { while (1) {} }
 
 // RUN: grep 'define i16 @f29()' %t
@@ -151,7 +151,7 @@
 // RUN: grep 'define float @f37()' %t
 struct s37 { float c[1][1]; } f37(void) { while (1) {} }
 
-// RUN: grep 'define void @f38(.struct.s38. noalias sret .agg.result)' %t
+// RUN: grep 'define void @f38(.struct.s38. sret .agg.result)' %t
 struct s38 { char a[3]; short b; } f38(void) { while (1) {} }
 
 // RUN: grep 'define void @f39(.struct.s39. byval align 16 .x)' %t

Modified: cfe/trunk/test/CodeGen/x86_64-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-arguments.c?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_64-arguments.c (original)
+++ cfe/trunk/test/CodeGen/x86_64-arguments.c Tue Apr 20 00:44:43 2010
@@ -58,7 +58,7 @@
 struct s10 { int a; int b; int : 0; };
 void f10(struct s10 a0) {}
 
-// RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t
+// RUN: grep 'define void @f11(.union.anon. sret .agg.result)' %t
 union { long double a; float b; } f11() { while (1) {} }
 
 // RUN: grep 'define i64 @f12_0()' %t
@@ -69,7 +69,7 @@
 
 // Check that sret parameter is accounted for when checking available integer
 // registers.
-// RUN: grep 'define void @f13(.struct.s13_0. noalias sret .agg.result, i32 .a, i32 .b, i32 .c, i32 .d, .struct.s13_1. byval .e, i32 .f)' %t
+// RUN: grep 'define void @f13(.struct.s13_0. sret .agg.result, i32 .a, i32 .b, i32 .c, i32 .d, .struct.s13_1. byval .e, i32 .f)' %t
 
 struct s13_0 { long long f0[3]; };
 struct s13_1 { long long f0[2]; };

Modified: cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp Tue Apr 20 00:44:43 2010
@@ -6,7 +6,7 @@
   int s;
 };
 
-// CHECK: define void @_Z1fv(%struct.S* noalias sret %
+// CHECK: define void @_Z1fv(%struct.S* sret %
 S f() { return S(); }
 // CHECK: define void @_Z1f1S(%struct.S*)
 void f(S) { }
@@ -17,7 +17,7 @@
   double c;
 };
 
-// CHECK: define void @_Z1gv(%class.C* noalias sret %
+// CHECK: define void @_Z1gv(%class.C* sret %
 C g() { return C(); }
 
 // CHECK: define void @_Z1f1C(%class.C*) 

Modified: cfe/trunk/test/CodeGenObjC/x86_64-struct-return-gc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/x86_64-struct-return-gc.m?rev=101877&r1=101876&r2=101877&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/x86_64-struct-return-gc.m (original)
+++ cfe/trunk/test/CodeGenObjC/x86_64-struct-return-gc.m Tue Apr 20 00:44:43 2010
@@ -25,7 +25,7 @@
 void Indirect_test(void) {
   struct Indirect i;
   
-  // CHECK: call void @indirect_func(%struct.Indirect* noalias sret
+  // CHECK: call void @indirect_func(%struct.Indirect* sret
   // CHECK: call i8* @objc_memmove_collectable(
   i = indirect_func();
 }





More information about the cfe-commits mailing list