<div dir="ltr">To be clear these were due to test failures under Release (no Asserts) coming from clang. Mehdi already has a fix in mind.<div><br></div><div>The bot I mention in followup to the original patch has the test failures.</div><div><br></div><div>-eric</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Mar 11, 2016 at 5:52 PM Eric Christopher via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: echristo<br>
Date: Fri Mar 11 19:47:11 2016<br>
New Revision: 263320<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=263320&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=263320&view=rev</a><br>
Log:<br>
Temporarily revert these patches:<br>
<br>
commit 60d9845f6a037122d9be9a6d92d4de617ef45b04<br>
Author: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br>
Date: Fri Mar 11 18:48:02 2016 +0000<br>
<br>
Fix clang crash: when CodeGenAction is initialized without a<br>
context, use the member and not the parameter<br>
<br>
From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br>
<br>
git-svn-id: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@263273" rel="noreferrer" target="_blank">https://llvm.org/svn/llvm-project/cfe/trunk@263273</a><br>
91177308-0d34-0410-b5e6-96231b3b80d8<br>
<br>
commit af7ce3bf04a75ad5124b457b805df26006bd215b<br>
Author: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br>
Date: Fri Mar 11 17:32:58 2016 +0000<br>
<br>
Fix build: use -> with pointers and not .<br>
<br>
Silly typo.<br>
<br>
From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br>
<br>
git-svn-id: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@263267" rel="noreferrer" target="_blank">https://llvm.org/svn/llvm-project/cfe/trunk@263267</a><br>
91177308-0d34-0410-b5e6-96231b3b80d8<br>
<br>
commit d0eea119192814954e7368c77d0dc5a9eeec1fbb<br>
Author: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br>
Date: Fri Mar 11 17:15:44 2016 +0000<br>
<br>
Remove compile time PreserveName switch based on NDEBUG<br>
<br>
Summary:<br>
Following r263086, we are now relying on a flag on the Context to<br>
discard Value names in release builds.<br>
<br>
Reviewers: chandlerc<br>
<br>
Subscribers: cfe-commits<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D18024" rel="noreferrer" target="_blank">http://reviews.llvm.org/D18024</a><br>
<br>
From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br>
<br>
git-svn-id: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@263257" rel="noreferrer" target="_blank">https://llvm.org/svn/llvm-project/cfe/trunk@263257</a><br>
91177308-0d34-0410-b5e6-96231b3b80d8<br>
<br>
until we can fix the Release builds.<br>
<br>
This reverts commits 263257, 263267, 263273<br>
<br>
Modified:<br>
cfe/trunk/lib/CodeGen/CGBuilder.h<br>
cfe/trunk/lib/CodeGen/CGCall.cpp<br>
cfe/trunk/lib/CodeGen/CGExpr.cpp<br>
cfe/trunk/lib/CodeGen/CodeGenAction.cpp<br>
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGBuilder.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuilder.h?rev=263320&r1=263319&r2=263320&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuilder.h?rev=263320&r1=263319&r2=263320&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGBuilder.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CGBuilder.h Fri Mar 11 19:47:11 2016<br>
@@ -23,7 +23,9 @@ class CodeGenFunction;<br>
/// \brief This is an IRBuilder insertion helper that forwards to<br>
/// CodeGenFunction::InsertHelper, which adds necessary metadata to<br>
/// instructions.<br>
-class CGBuilderInserter : protected llvm::IRBuilderDefaultInserter {<br>
+template <bool PreserveNames><br>
+class CGBuilderInserter<br>
+ : protected llvm::IRBuilderDefaultInserter<PreserveNames> {<br>
public:<br>
CGBuilderInserter() = default;<br>
explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}<br>
@@ -37,10 +39,17 @@ private:<br>
CodeGenFunction *CGF = nullptr;<br>
};<br>
<br>
-typedef CGBuilderInserter CGBuilderInserterTy;<br>
+// Don't preserve names on values in an optimized build.<br>
+#ifdef NDEBUG<br>
+#define PreserveNames false<br>
+#else<br>
+#define PreserveNames true<br>
+#endif<br>
<br>
-typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy><br>
- CGBuilderBaseTy;<br>
+typedef CGBuilderInserter<PreserveNames> CGBuilderInserterTy;<br>
+<br>
+typedef llvm::IRBuilder<PreserveNames, llvm::ConstantFolder,<br>
+ CGBuilderInserterTy> CGBuilderBaseTy;<br>
<br>
class CGBuilderTy : public CGBuilderBaseTy {<br>
/// Storing a reference to the type cache here makes it a lot easier<br>
@@ -296,6 +305,8 @@ public:<br>
}<br>
};<br>
<br>
+#undef PreserveNames<br>
+<br>
} // end namespace CodeGen<br>
} // end namespace clang<br>
<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=263320&r1=263319&r2=263320&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=263320&r1=263319&r2=263320&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Mar 11 19:47:11 2016<br>
@@ -3840,7 +3840,7 @@ RValue CodeGenFunction::EmitCall(const C<br>
}<br>
<br>
llvm::Instruction *CI = CS.getInstruction();<br>
- if (!CI->getType()->isVoidTy())<br>
+ if (Builder.isNamePreserving() && !CI->getType()->isVoidTy())<br>
CI->setName("call");<br>
<br>
// Emit any writebacks immediately. Arguably this should happen<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=263320&r1=263319&r2=263320&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=263320&r1=263319&r2=263320&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Mar 11 19:47:11 2016<br>
@@ -66,6 +66,8 @@ Address CodeGenFunction::CreateTempAlloc<br>
/// block.<br>
llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,<br>
const Twine &Name) {<br>
+ if (!Builder.isNamePreserving())<br>
+ return new llvm::AllocaInst(Ty, nullptr, "", AllocaInsertPt);<br>
return new llvm::AllocaInst(Ty, nullptr, Name, AllocaInsertPt);<br>
}<br>
<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=263320&r1=263319&r2=263320&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=263320&r1=263319&r2=263320&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Fri Mar 11 19:47:11 2016<br>
@@ -656,13 +656,7 @@ void BackendConsumer::DiagnosticHandlerI<br>
<br>
CodeGenAction::CodeGenAction(unsigned _Act, LLVMContext *_VMContext)<br>
: Act(_Act), VMContext(_VMContext ? _VMContext : new LLVMContext),<br>
- OwnsVMContext(!_VMContext) {<br>
-#ifdef NDEBUG<br>
- // FIXME: change this to be controlled by a cc1 flag that the driver passes,<br>
- // on the model of --disable-free<br>
- VMContext->setDiscardValueNames(true);<br>
-#endif<br>
-}<br>
+ OwnsVMContext(!_VMContext) {}<br>
<br>
CodeGenAction::~CodeGenAction() {<br>
TheModule.reset();<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=263320&r1=263319&r2=263320&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=263320&r1=263319&r2=263320&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Mar 11 19:47:11 2016<br>
@@ -747,7 +747,9 @@ void CodeGenFunction::StartFunction(Glob<br>
// later. Don't create this with the builder, because we don't want it<br>
// folded.<br>
llvm::Value *Undef = llvm::UndefValue::get(Int32Ty);<br>
- AllocaInsertPt = new llvm::BitCastInst(Undef, Int32Ty, "allocapt", EntryBB);<br>
+ AllocaInsertPt = new llvm::BitCastInst(Undef, Int32Ty, "", EntryBB);<br>
+ if (Builder.isNamePreserving())<br>
+ AllocaInsertPt->setName("allocapt");<br>
<br>
ReturnBlock = getJumpDestInCurrentScope("return");<br>
<br>
@@ -1860,14 +1862,26 @@ void CodeGenFunction::InsertHelper(llvm:<br>
CGM.getSanitizerMetadata()->disableSanitizerForInstruction(I);<br>
}<br>
<br>
-void CGBuilderInserter::InsertHelper(<br>
+template <bool PreserveNames><br>
+void CGBuilderInserter<PreserveNames>::InsertHelper(<br>
llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB,<br>
llvm::BasicBlock::iterator InsertPt) const {<br>
- llvm::IRBuilderDefaultInserter::InsertHelper(I, Name, BB, InsertPt);<br>
+ llvm::IRBuilderDefaultInserter<PreserveNames>::InsertHelper(I, Name, BB,<br>
+ InsertPt);<br>
if (CGF)<br>
CGF->InsertHelper(I, Name, BB, InsertPt);<br>
}<br>
<br>
+#ifdef NDEBUG<br>
+#define PreserveNames false<br>
+#else<br>
+#define PreserveNames true<br>
+#endif<br>
+template void CGBuilderInserter<PreserveNames>::InsertHelper(<br>
+ llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB,<br>
+ llvm::BasicBlock::iterator InsertPt) const;<br>
+#undef PreserveNames<br>
+<br>
static bool hasRequiredFeatures(const SmallVectorImpl<StringRef> &ReqFeatures,<br>
CodeGenModule &CGM, const FunctionDecl *FD,<br>
std::string &FirstMissing) {<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>