[llvm-branch-commits] [llvm-branch] r294335 - Merging r293017 and r294267:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 7 11:09:05 PST 2017


Author: hans
Date: Tue Feb  7 13:09:04 2017
New Revision: 294335

URL: http://llvm.org/viewvc/llvm-project?rev=294335&view=rev
Log:
Merging r293017 and r294267:
------------------------------------------------------------------------
r293017 | chapuni | 2017-01-24 20:26:29 -0800 (Tue, 24 Jan 2017) | 5 lines

Rewind instantiations of OuterAnalysisManagerProxy in r289317, r291651, and r291662.

I found root class should be instantiated for variadic tempate to instantiate static member explicitly.

This will fix failures in mingw DLL build.
------------------------------------------------------------------------

------------------------------------------------------------------------
r294267 | chandlerc | 2017-02-06 17:50:48 -0800 (Mon, 06 Feb 2017) | 18 lines

Revert r293017 and fix the actual underlying issue.

The patch committed in r293017, as discussed on the list, doesn't really
make sense but was causing an actual issue to go away.

The issue turns out to be that in one place the extra template arguments
were dropped from the OuterAnalysisManagerProxy. This in turn caused the
types used in one set of places to access the key to be completely
different from the types used in another set of places for both Loop and
CGSCC cases where there are extra arguments.

I have literally no idea how anything seemed to work with this bug in
place. It blows my mind. But it did except for mingw64 in a DLL build.

I've added a really handy static assert that helps ensure we don't break
this in the future. It immediately diagnoses the issue with a compile
failure and a very clear error message. Much better that staring at
backtraces on a build bot. =]
------------------------------------------------------------------------

Modified:
    llvm/branches/release_40/   (props changed)
    llvm/branches/release_40/include/llvm/IR/PassManager.h

Propchange: llvm/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb  7 13:09:04 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,293021,293025,293230,293259,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294102,294203
+/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,293017,293021,293025,293230,293259,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294102,294203,294267

Modified: llvm/branches/release_40/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/include/llvm/IR/PassManager.h?rev=294335&r1=294334&r2=294335&view=diff
==============================================================================
--- llvm/branches/release_40/include/llvm/IR/PassManager.h (original)
+++ llvm/branches/release_40/include/llvm/IR/PassManager.h Tue Feb  7 13:09:04 2017
@@ -311,6 +311,8 @@ template <typename IRUnitT, typename...
 template <typename DerivedT> struct PassInfoMixin {
   /// Gets the name of the pass we are mixed into.
   static StringRef name() {
+    static_assert(std::is_base_of<PassInfoMixin, DerivedT>::value,
+                  "Must pass the derived type as the template argument!");
     StringRef Name = getTypeName<DerivedT>();
     if (Name.startswith("llvm::"))
       Name = Name.drop_front(strlen("llvm::"));
@@ -339,7 +341,11 @@ struct AnalysisInfoMixin : PassInfoMixin
   /// known platform with this limitation is Windows DLL builds, specifically
   /// building each part of LLVM as a DLL. If we ever remove that build
   /// configuration, this mixin can provide the static key as well.
-  static AnalysisKey *ID() { return &DerivedT::Key; }
+  static AnalysisKey *ID() {
+    static_assert(std::is_base_of<AnalysisInfoMixin, DerivedT>::value,
+                  "Must pass the derived type as the template argument!");
+    return &DerivedT::Key;
+  }
 };
 
 /// This templated class represents "all analyses that operate over \<a
@@ -1010,7 +1016,7 @@ extern template class InnerAnalysisManag
 template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
 class OuterAnalysisManagerProxy
     : public AnalysisInfoMixin<
-          OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>> {
+          OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>> {
 public:
   /// \brief Result proxy object for \c OuterAnalysisManagerProxy.
   class Result {
@@ -1072,7 +1078,7 @@ public:
 
 private:
   friend AnalysisInfoMixin<
-      OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
+      OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>>;
   static AnalysisKey Key;
 
   const AnalysisManagerT *AM;




More information about the llvm-branch-commits mailing list