[llvm-commits] [poolalloc] r165691 - in /poolalloc/trunk: lib/AssistDS/TypeChecks.cpp lib/PoolAllocate/PoolAllocate.cpp test/pa/clone/AttrTest.ll

Will Dietz wdietz2 at illinois.edu
Wed Oct 10 18:50:34 PDT 2012


Author: wdietz2
Date: Wed Oct 10 20:50:34 2012
New Revision: 165691

URL: http://llvm.org/viewvc/llvm-project?rev=165691&view=rev
Log:
Fix Attributes API usage properly this time.  AttrTest passes again.

Also, extend AttrTest to ensure poolalloc does the right thing
for sret parameters.

Modified:
    poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
    poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
    poolalloc/trunk/test/pa/clone/AttrTest.ll

Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=165691&r1=165690&r2=165691&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Wed Oct 10 20:50:34 2012
@@ -1153,10 +1153,12 @@
   }
 
   // remove the byval attribute from the function
+  Attributes::Builder B;
+  B.addAttribute(Attributes::ByVal);
   for (Function::arg_iterator I = F.arg_begin(); I != F.arg_end(); ++I) {
     if (!I->hasByValAttr())
       continue;
-    I->removeAttr(Attributes(Attributes::ByVal));
+    I->removeAttr(Attributes::get(B));
   }
   return true;
 }

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=165691&r1=165690&r2=165691&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Wed Oct 10 20:50:34 2012
@@ -996,8 +996,10 @@
   //
   Function::ArgumentListType & ArgList = New->getArgumentList ();
   Function::ArgumentListType::iterator arg = ArgList.begin();
+  Attributes::Builder B;
+  B.addAttribute(Attributes::StructRet);
   for (; arg != ArgList.end(); ++arg) {
-    arg->removeAttr (Attributes(Attributes::StructRet));
+    arg->removeAttr (Attributes::get(B));
   }
 
   //

Modified: poolalloc/trunk/test/pa/clone/AttrTest.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/pa/clone/AttrTest.ll?rev=165691&r1=165690&r2=165691&view=diff
==============================================================================
--- poolalloc/trunk/test/pa/clone/AttrTest.ll (original)
+++ poolalloc/trunk/test/pa/clone/AttrTest.ll Wed Oct 10 20:50:34 2012
@@ -1,10 +1,14 @@
-;This test does some very basic checking on the attribute copying of arguments
+; This test does some very basic checking on the attribute copying of arguments
 ;RUN: paopt %s -paheur-AllButUnreachableFromMemory -poolalloc -o %t.bc |& grep "Pool allocating.*nodes!"
+;|& grep "Pool allocating.*nodes!"
 ;RUN: llvm-dis %t.bc -o %t.ll
-;Make sure 'nocapture' attribute isn't copied to new PD argument
-;RUN: cat %t.ll | grep -v ".*@.*(.*nocapture.*,.*,.*)"
-;But ensure the other arguments have their original attributes
-;RUN: cat %t.ll | grep ".*@.*(.*,.*zeroext.*,.*nocapture.*)"
+; Make sure 'nocapture' attribute isn't copied to new PD argument
+;RUN: cat %t.ll | grep -v ".*@attr_clone(.*nocapture.*,.*,.*)"
+; But ensure the other arguments have their original attributes
+;RUN: cat %t.ll | grep ".*@attr_clone(.*,.*zeroext.*,.*nocapture.*)"
+; Also, ensure sret attributes are dropped from first parameter
+; (verifier also catches this)
+;RUN: cat %t.ll | grep -v ".*@attr2_clone(.*sret.*)"
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-unknown-linux-gnu"
 
@@ -18,3 +22,8 @@
   unreachable
 }
 
+define internal void @attr2(i8** sret %NeedsPool) {
+entry:
+  unreachable
+}
+





More information about the llvm-commits mailing list