<div dir="ltr">I think Kostya took care of it on Friday.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 20, 2015 at 11:49 AM, H.J. Lu <span dir="ltr"><<a href="mailto:hjl.tools@gmail.com" target="_blank">hjl.tools@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">r232788 caused:<br>
<br>
--<br>
Exit Code: 1<br>
<br>
Command Output (stderr):<br>
--<br>
error: unknown argument: '-fdefine-sized-deallocation'<br>
<br>
in compiler-rt test: TestCases/Linux/sized_delete_test.cc<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Mar 20, 2015 at 10:15 AM, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br>
> This code ultimately went away in r232731 and we took a new approach in<br>
> r232788.<br>
><br>
> On Fri, Mar 6, 2015 at 12:08 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:<br>
>><br>
>> > On Feb 26, 2015, at 12:08 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:<br>
>> ><br>
>> >> On Feb 25, 2015, at 3:48 PM, Larisse Voufo <<a href="mailto:lvoufo@google.com">lvoufo@google.com</a>> wrote:<br>
>> >> Author: lvoufo<br>
>> >> Date: Wed Feb 25 17:48:43 2015<br>
>> >> New Revision: 230580<br>
>> >><br>
>> >> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=230580&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=230580&view=rev</a><br>
>> >> Log:<br>
>> >> Improvement on sized deallocation from r230160:<br>
>> >> Do not declare sized deallocation functions dependently on whether it<br>
>> >> is found in global scope. Instead, enforce the branching in emitted code by<br>
>> >> (1) declaring the functions extern_weak and (2) emitting sized delete<br>
>> >> expressions as a branching between both forms delete.<br>
>> >><br>
>> >> Modified:<br>
>> >>   cfe/trunk/lib/CodeGen/CGExprCXX.cpp<br>
>> >>   cfe/trunk/lib/Sema/SemaExprCXX.cpp<br>
>> >>   cfe/trunk/test/CodeGenCXX/cxx1y-sized-deallocation.cpp<br>
>> >>   cfe/trunk/test/CodeGenCXX/implicit-allocation-functions.cpp<br>
>> >>   cfe/trunk/test/CodeGenCXX/pr21754.cpp<br>
>> >><br>
>> >> Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp<br>
>> >> URL:<br>
>> >> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=230580&r1=230579&r2=230580&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=230580&r1=230579&r2=230580&view=diff</a><br>
>> >><br>
>> >> ==============================================================================<br>
>> >> --- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)<br>
>> >> +++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Feb 25 17:48:43 2015<br>
>> >> @@ -1422,6 +1422,71 @@ CodeGenFunction::pushCallObjectDeleteCle<br>
>> >>                                        OperatorDelete, ElementType);<br>
>> >> }<br>
>> >><br>
>> >> +static void EmitDelete(CodeGenFunction &CGF,<br>
>> >> +                              const CXXDeleteExpr *DE,<br>
>> >> +                              llvm::Value *Ptr,<br>
>> >> +                              QualType ElementType);<br>
>> >> +<br>
>> >> +static void EmitSizedDelete(CodeGenFunction &CGF,<br>
>> >> +                            const CXXDeleteExpr *DE,<br>
>> >> +                            llvm::Value *Ptr,<br>
>> >> +                            QualType ElementType,<br>
>> >> +                            FunctionDecl* UnsizedDealloc) {<br>
>> >> +<br>
>> >> +  if (CGF.getLangOpts().DefineSizedDeallocation) {<br>
>> >> +    // The delete operator in use is fixed. So simply emit the delete<br>
>> >> expr.<br>
>> >> +    EmitDelete(CGF, DE, Ptr, ElementType);<br>
>> >> +    return;<br>
>> >> +  }<br>
>> >> +<br>
>> >> +  assert(UnsizedDealloc && "We must be emiting a 'sized' delete<br>
>> >> expr");<br>
>> >> +<br>
>> >> +  // Branch off over the value of operator delete:<br>
>> >> +  // Use the sized form if available, and default on the unsized form<br>
>> >> otherwise.<br>
>> >> +  llvm::BasicBlock *ThenBlock = CGF.createBasicBlock("if.then");<br>
>> >> +  llvm::BasicBlock *ContBlock = CGF.createBasicBlock("if.end");<br>
>> >> +  llvm::BasicBlock *ElseBlock = CGF.createBasicBlock("if.else");<br>
>> >> +<br>
>> >> +  // Emit the condition.<br>
>> >> +  const FunctionDecl *OpDelFD = DE->getOperatorDelete();<br>
>> >> +  llvm::Value *OpDelAddr = CGF.CGM.GetAddrOfFunction(OpDelFD);<br>
>> >> +  //llvm::Function *OpDel = dyn_cast<llvm::Function>(OpDelAddr);<br>
>> >> +  llvm::Value *SDE = CGF.Builder.CreateIsNotNull(OpDelAddr,<br>
>> >> "sized.del.exists");<br>
>> >> +  CGF.Builder.CreateCondBr(SDE, ThenBlock, ElseBlock);<br>
>> >> +<br>
>> >> +  // Emit the 'then' code.<br>
>> >> +  CGF.EmitBlock(ThenBlock);<br>
>> >> +  EmitDelete(CGF, DE, Ptr, ElementType);<br>
>> >> +  CGF.EmitBranch(ContBlock);<br>
>> >> +<br>
>> >> +  // Compute the 'unsized' delete expr.<br>
>> >> +  CXXDeleteExpr * E = const_cast<CXXDeleteExpr*>(DE);<br>
>> >> +  CXXDeleteExpr *UnsizedDE =<br>
>> >> +  new (CGF.getContext()) CXXDeleteExpr(CGF.getContext().VoidTy,<br>
>> >> +                                       E->isGlobalDelete(),<br>
>> >> +                                       E->isArrayForm(),<br>
>> >> +                                       E->isArrayFormAsWritten(),<br>
>> >> +<br>
>> >> E->doesUsualArrayDeleteWantSize(),<br>
>> >> +                                       UnsizedDealloc,<br>
>> >> +                                       E->getArgument(),<br>
>> >> +                                       E->getLocStart());<br>
>> ><br>
>> > Instead of doing it this way, please introduce a common function to call<br>
>> > from EmitDeleteCall and the CallArrayDelete cleanup.<br>
>> ><br>
>> > Doing it this way unnecessarily clones the object / array destruction<br>
>> > code,<br>
>> > causes a useless branch when making a virtual call to the deleting<br>
>> > destructor,<br>
>> > and fails to branch appropriately within a deleting destructor.<br>
>> ><br>
>> > The common function will also be a natural place in the future to check<br>
>> > the<br>
>> > language that elides the dynamic check and assumes that the sized<br>
>> > deallocation function exists.  (The reverse option will be implemented<br>
>> > by<br>
>> > having Sema just specify an unsized deallocation function.)<br>
>><br>
>> Ping.<br>
>><br>
>> John.<br>
>> _______________________________________________<br>
>> cfe-commits mailing list<br>
>> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
H.J.<br>
</font></span></blockquote></div><br></div>