[llvm-branch-commits] [llvm-branch] r282615 - Cherry pick r281957 (see http://llvm.org/PR30463)
Author: matze Date: Wed Sep 28 13:17:12 2016 New Revision: 282615 URL: http://llvm.org/viewvc/llvm-project?rev=282615&view=rev Log: Cherry pick r281957 (see http://llvm.org/PR30463) Added: llvm/branches/release_39/test/CodeGen/X86/branchfolding-undef.mir - copied unchanged from r281957, llvm/trunk/test/CodeGen/X86/branchfolding-undef.mir Modified: llvm/branches/release_39/ (props changed) llvm/branches/release_39/lib/CodeGen/BranchFolding.cpp Propchange: llvm/branches/release_39/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Sep 28 13:17:12 2016 @@ -1,3 +1,3 @@ /llvm/branches/Apple/Pertwee:110850,110961 /llvm/branches/type-system-rewrite:133420-134817 -/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276051,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276648,276676,276712,276740,276823,276956,276980,277093,277114,277135,277371,277399,277500,277504,277625,277691,277693,23,278002,278086,278133,278157,278343,278370,278413,278558-278559,278562,278569,278571,278573,278575,278584,278841,278900,278938,278999,279125,279268,279369,279647 +/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276051,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276648,276676,276712,276740,276823,276956,276980,277093,277114,277135,277371,277399,277500,277504,277625,277691,277693,23,278002,278086,278133,278157,278343,278370,278413,278558-278559,278562,278569,278571,278573,278575,278584,278841,278900,278938,278999,279125,279268,279369,279647,281957 Modified: llvm/branches/release_39/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/CodeGen/BranchFolding.cpp?rev=282615&r1=282614&r2=282615&view=diff == --- llvm/branches/release_39/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/branches/release_39/lib/CodeGen/BranchFolding.cpp Wed Sep 28 13:17:12 2016 @@ -776,9 +776,8 @@ bool BranchFolder::CreateCommonTailOnlyB } static void -mergeMMOsFromMemoryOperations(MachineBasicBlock::iterator MBBIStartPos, - MachineBasicBlock &MBBCommon) { - // Merge MMOs from memory operations in the common block. +mergeOperations(MachineBasicBlock::iterator MBBIStartPos, +MachineBasicBlock &MBBCommon) { MachineBasicBlock *MBB = MBBIStartPos->getParent(); // Note CommonTailLen does not necessarily matches the size of // the common BB nor all its instructions because of debug @@ -808,8 +807,18 @@ mergeMMOsFromMemoryOperations(MachineBas "Reached BB end within common tail length!"); assert(MBBICommon->isIdenticalTo(*MBBI) && "Expected matching MIIs!"); +// Merge MMOs from memory operations in the common block. if (MBBICommon->mayLoad() || MBBICommon->mayStore()) MBBICommon->setMemRefs(MBBICommon->mergeMemRefsWith(*MBBI)); +// Drop undef flags if they aren't present in all merged instructions. +for (unsigned I = 0, E = MBBICommon->getNumOperands(); I != E; ++I) { + MachineOperand &MO = MBBICommon->getOperand(I); + if (MO.isReg() && MO.isUndef()) { +const MachineOperand &OtherMO = MBBI->getOperand(I); +if (!OtherMO.isUndef()) + MO.setIsUndef(false); + } +} ++MBBI; ++MBBICommon; @@ -928,8 +937,8 @@ bool BranchFolder::TryTailMergeBlocks(Ma continue; DEBUG(dbgs() << "BB#" << SameTails[i].getBlock()->getNumber() << (i == e-1 ? "" : ", ")); - // Merge MMOs from memory operations as needed. - mergeMMOsFromMemoryOperations(SameTails[i].getTailStartPos(), *MBB); + // Merge operations (MMOs, undef flags) + mergeOperations(SameTails[i].getTailStartPos(), *MBB); // Hack the end off BB i, making it jump to BB commonTailIndex instead. ReplaceTailWithBranchTo(SameTails[i].getTailStartPos(), MBB); // BB i is no longer a predecessor of SuccBB; remove it from the worklist. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [cfe-branch] r282636 - Merging rr280190:
Author: ericwf Date: Wed Sep 28 16:25:06 2016 New Revision: 282636 URL: http://llvm.org/viewvc/llvm-project?rev=282636&view=rev Log: Merging rr280190: r280190 | rsmith | 2016-08-30 20:15:21 -0600 (Tue, 30 Aug 2016) | 12 lines PR12298 et al: don't recursively instantiate a template specialization from within the instantiation of that same specialization. This could previously happen for eagerly-instantiated function templates, variable templates, exception specifications, default arguments, and a handful of other cases. We still have an issue here for default template arguments that recursively make use of themselves and likewise for substitution into the type of a non-type template parameter, but in those cases we're producing a different entity each time, so they should instead be caught by the instantiation depth limit. However, currently we will typically run out of stack before we reach it. :( Modified: cfe/branches/release_39/include/clang/AST/DeclTemplate.h cfe/branches/release_39/include/clang/Basic/DiagnosticSemaKinds.td cfe/branches/release_39/include/clang/Sema/Sema.h cfe/branches/release_39/lib/Sema/SemaDecl.cpp cfe/branches/release_39/lib/Sema/SemaExpr.cpp cfe/branches/release_39/lib/Sema/SemaTemplate.cpp cfe/branches/release_39/lib/Sema/SemaTemplateInstantiate.cpp cfe/branches/release_39/lib/Sema/SemaTemplateInstantiateDecl.cpp cfe/branches/release_39/test/SemaTemplate/instantiate-self.cpp cfe/branches/release_39/test/SemaTemplate/instantiation-depth-exception-spec.cpp cfe/branches/release_39/test/SemaTemplate/instantiation-depth.cpp Modified: cfe/branches/release_39/include/clang/AST/DeclTemplate.h URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/include/clang/AST/DeclTemplate.h?rev=282636&r1=282635&r2=282636&view=diff == --- cfe/branches/release_39/include/clang/AST/DeclTemplate.h (original) +++ cfe/branches/release_39/include/clang/AST/DeclTemplate.h Wed Sep 28 16:25:06 2016 @@ -44,6 +44,8 @@ class VarTemplatePartialSpecializationDe typedef llvm::PointerUnion3 TemplateParameter; +NamedDecl *getAsNamedDecl(TemplateParameter P); + /// \brief Stores a list of template parameters for a TemplateDecl and its /// derived classes. class TemplateParameterList final @@ -2912,6 +2914,14 @@ public: friend class ASTDeclWriter; }; +inline NamedDecl *getAsNamedDecl(TemplateParameter P) { + if (auto *PD = P.dyn_cast()) +return PD; + if (auto *PD = P.dyn_cast()) +return PD; + return P.get(); +} + } /* end of namespace clang */ #endif Modified: cfe/branches/release_39/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/include/clang/Basic/DiagnosticSemaKinds.td?rev=282636&r1=282635&r2=282636&view=diff == --- cfe/branches/release_39/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/branches/release_39/include/clang/Basic/DiagnosticSemaKinds.td Wed Sep 28 16:25:06 2016 @@ -6917,6 +6917,10 @@ def err_in_class_initializer_not_yet_par def err_in_class_initializer_not_yet_parsed_outer_class : Error<"cannot use defaulted default constructor of %0 within " "%1 outside of member functions because %2 has an initializer">; +def err_in_class_initializer_cycle +: Error<"default member initializer for %0 uses itself">; +def err_exception_spec_cycle +: Error<"exception specification of %0 uses itself">; def ext_in_class_initializer_non_constant : Extension< "in-class initializer for static data member is not a constant expression; " Modified: cfe/branches/release_39/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/include/clang/Sema/Sema.h?rev=282636&r1=282635&r2=282636&view=diff == --- cfe/branches/release_39/include/clang/Sema/Sema.h (original) +++ cfe/branches/release_39/include/clang/Sema/Sema.h Wed Sep 28 16:25:06 2016 @@ -18,6 +18,7 @@ #include "clang/AST/Attr.h" #include "clang/AST/Availability.h" #include "clang/AST/DeclarationName.h" +#include "clang/AST/DeclTemplate.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprObjC.h" #include "clang/AST/ExternalASTSource.h" @@ -6613,10 +6614,10 @@ public: TemplateInstantiation, /// We are instantiating a default argument for a template - /// parameter. The Entity is the template, and - /// TemplateArgs/NumTemplateArguments provides the template - /// arguments as specified. - /// FIXME: Use a TemplateArgumentList + /// parameter. The Entity is the template parameter whose argument is + /// being instantiated, t