[llvm] r276668 - Don't use iplist in SymbolRewriter. NFC.

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 16:27:55 PDT 2016


And fixed again in r276703, thanks to Hans.

On Mon, Jul 25, 2016 at 2:58 PM, Michael Kuperstein <mkuper at google.com>
wrote:

> And I broke it again with r276687. Looking into it.
>
> On Mon, Jul 25, 2016 at 1:32 PM, Jordan Rose <jordan_rose at apple.com>
> wrote:
>
>> Oops, didn’t realize MSVC has different behavior here. Thanks, Michael,
>> will fix.
>>
>> Jordan
>>
>> On Jul 25, 2016, at 13:24, Michael Kuperstein <mkuper at google.com> wrote:
>>
>> Hi Mike,
>>
>> Already fixed in r276672.
>> The sanitizer bot is still red, but for an unrelated reason - any build
>> that picked that fix up would have also picked up r276671 that apparently
>> breaks StringSwitch.
>>
>> Thanks,
>>   Michae
>>
>> On Mon, Jul 25, 2016 at 1:16 PM, Mike Aizatsky <aizatsky at google.com>
>> wrote:
>>
>>> Michael,
>>>
>>> This broke sanitizer-windows bot:
>>>
>>> http://lab.llvm.org:8011/builders/sanitizer-windows/builds/26212
>>>
>>> http://lab.llvm.org:8011/builders/sanitizer-windows/builds/26212/steps/run%20tests/logs/stdio
>>>
>>> FAILED: lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SymbolRewriter.cpp.obj
>>> C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~1\cl.exe   /nologo /TP -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_DEBUG_POINTER_IMPL="" -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib\Transforms\Utils -IC:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils -Iinclude -IC:\b\slave\sanitizer-windows\llvm\include /DWIN32 /D_WINDOWS   /W4 -wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /Zc:inline /Oi /Zc:rvalueCast /MD /O2 /Ob2   -UNDEBUG  /EHs-c- /GR- /showIncludes /Folib\Transforms\Utils\CMakeFiles\LLVMTransformUtils.dir\SymbolRewriter.cpp.obj /Fdlib\Transforms\Utils\CMakeFiles\LLVMTransformUtils.dir\ /FS -c C:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils\SymbolRewriter.cpp
>>> C:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils\SymbolRewriter.cpp(365) : error C2668: 'llvm::make_unique' : ambiguous call to overloaded function
>>>         C:\b\slave\sanitizer-windows\llvm\include\llvm/ADT/STLExtras.h(453): could be 'std::unique_ptr<`anonymous-namespace'::ExplicitRewriteFunctionDescriptor,std::default_delete<`anonymous-namespace'::ExplicitRewriteFunctionDescriptor>> llvm::make_unique<`anonymous-namespace'::ExplicitRewriteFunctionDescriptor,std::string&,std::string&,bool&>(std::string &,std::string &,bool &)'
>>>         C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\memory(1637): or       'std::unique_ptr<`anonymous-namespace'::ExplicitRewriteFunctionDescriptor,std::default_delete<`anonymous-namespace'::ExplicitRewriteFunctionDescriptor>> std::make_unique<`anonymous-namespace'::ExplicitRewriteFunctionDescriptor,std::string&,std::string&,bool&>(std::string &,std::string &,bool &)' [found using argument-dependent lookup]
>>>         while trying to match the argument list '(std::string, std::string, bool)'
>>> C:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils\SymbolRewriter.cpp(368) : error C2668: 'llvm::make_unique' : ambiguous call to overloaded function
>>>         C:\b\slave\sanitizer-windows\llvm\include\llvm/ADT/STLExtras.h(453): could be 'std::unique_ptr<`anonymous-namespace'::PatternRewriteFunctionDescriptor,std::default_delete<`anonymous-namespace'::PatternRewriteFunctionDescriptor>> llvm::make_unique<`anonymous-namespace'::PatternRewriteFunctionDescriptor,std::string&,std::string&>(std::string &,std::string &)'
>>>         C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\memory(1637): or       'std::unique_ptr<`anonymous-namespace'::PatternRewriteFunctionDescriptor,std::default_delete<`anonymous-namespace'::PatternRewriteFunctionDescriptor>> std::make_unique<`anonymous-namespace'::PatternRewriteFunctionDescriptor,std::string&,std::string&>(std::string &,std::string &)' [found using argument-dependent lookup]
>>>         while trying to match the argument list '(std::string, std::string)'
>>> C:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils\SymbolRewriter.cpp(428) : error C2668: 'llvm::make_unique' : ambiguous call to overloaded function
>>>         C:\b\slave\sanitizer-windows\llvm\include\llvm/ADT/STLExtras.h(453): could be 'std::unique_ptr<`anonymous-namespace'::ExplicitRewriteGlobalVariableDescriptor,std::default_delete<`anonymous-namespace'::ExplicitRewriteGlobalVariableDescriptor>> llvm::make_unique<`anonymous-namespace'::ExplicitRewriteGlobalVariableDescriptor,std::string&,std::string&,bool>(std::string &,std::string &,bool &&)'
>>>         C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\memory(1637): or       'std::unique_ptr<`anonymous-namespace'::ExplicitRewriteGlobalVariableDescriptor,std::default_delete<`anonymous-namespace'::ExplicitRewriteGlobalVariableDescriptor>> std::make_unique<`anonymous-namespace'::ExplicitRewriteGlobalVariableDescriptor,std::string&,std::string&,bool>(std::string &,std::string &,bool &&)' [found using argument-dependent lookup]
>>>         while trying to match the argument list '(std::string, std::string, bool)'
>>> C:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils\SymbolRewriter.cpp(431) : error C2668: 'llvm::make_unique' : ambiguous call to overloaded function
>>>         C:\b\slave\sanitizer-windows\llvm\include\llvm/ADT/STLExtras.h(453): could be 'std::unique_ptr<`anonymous-namespace'::PatternRewriteGlobalVariableDescriptor,std::default_delete<`anonymous-namespace'::PatternRewriteGlobalVariableDescriptor>> llvm::make_unique<`anonymous-namespace'::PatternRewriteGlobalVariableDescriptor,std::string&,std::string&>(std::string &,std::string &)'
>>>         C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\memory(1637): or       'std::unique_ptr<`anonymous-namespace'::PatternRewriteGlobalVariableDescriptor,std::default_delete<`anonymous-namespace'::PatternRewriteGlobalVariableDescriptor>> std::make_unique<`anonymous-namespace'::PatternRewriteGlobalVariableDescriptor,std::string&,std::string&>(std::string &,std::string &)' [found using argument-dependent lookup]
>>>         while trying to match the argument list '(std::string, std::string)'
>>> C:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils\SymbolRewriter.cpp(491) : error C2668: 'llvm::make_unique' : ambiguous call to overloaded function
>>>         C:\b\slave\sanitizer-windows\llvm\include\llvm/ADT/STLExtras.h(453): could be 'std::unique_ptr<`anonymous-namespace'::ExplicitRewriteNamedAliasDescriptor,std::default_delete<`anonymous-namespace'::ExplicitRewriteNamedAliasDescriptor>> llvm::make_unique<`anonymous-namespace'::ExplicitRewriteNamedAliasDescriptor,std::string&,std::string&,bool>(std::string &,std::string &,bool &&)'
>>>         C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\memory(1637): or       'std::unique_ptr<`anonymous-namespace'::ExplicitRewriteNamedAliasDescriptor,std::default_delete<`anonymous-namespace'::ExplicitRewriteNamedAliasDescriptor>> std::make_unique<`anonymous-namespace'::ExplicitRewriteNamedAliasDescriptor,std::string&,std::string&,bool>(std::string &,std::string &,bool &&)' [found using argument-dependent lookup]
>>>         while trying to match the argument list '(std::string, std::string, bool)'
>>> C:\b\slave\sanitizer-windows\llvm\lib\Transforms\Utils\SymbolRewriter.cpp(494) : error C2668: 'llvm::make_unique' : ambiguous call to overloaded function
>>>         C:\b\slave\sanitizer-windows\llvm\include\llvm/ADT/STLExtras.h(453): could be 'std::unique_ptr<`anonymous-namespace'::PatternRewriteNamedAliasDescriptor,std::default_delete<`anonymous-namespace'::PatternRewriteNamedAliasDescriptor>> llvm::make_unique<`anonymous-namespace'::PatternRewriteNamedAliasDescriptor,std::string&,std::string&>(std::string &,std::string &)'
>>>         C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\memory(1637): or       'std::unique_ptr<`anonymous-namespace'::PatternRewriteNamedAliasDescriptor,std::default_delete<`anonymous-namespace'::PatternRewriteNamedAliasDescriptor>> std::make_unique<`anonymous-namespace'::PatternRewriteNamedAliasDescriptor,std::string&,std::string&>(std::string &,std::string &)' [found using argument-dependent lookup]
>>>         while trying to match the argument list '(std::string, std::string)'
>>>
>>>
>>>
>>>
>>> On Mon, Jul 25, 2016 at 11:18 AM Michael Kuperstein via llvm-commits <
>>> llvm-commits at lists.llvm.org> wrote:
>>>
>>>> Author: mkuper
>>>> Date: Mon Jul 25 13:10:54 2016
>>>> New Revision: 276668
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=276668&view=rev
>>>> Log:
>>>> Don't use iplist in SymbolRewriter. NFC.
>>>>
>>>> There didn't appear to be a good reason to use iplist in this case, a
>>>> regular
>>>> list of unique_ptr works just as well.
>>>> Change made in preparation to a new PM port (since iplist is not
>>>> moveable).
>>>>
>>>> Modified:
>>>>     llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h
>>>>     llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp
>>>>
>>>> Modified: llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h?rev=276668&r1=276667&r2=276668&view=diff
>>>>
>>>> ==============================================================================
>>>> --- llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h (original)
>>>> +++ llvm/trunk/include/llvm/Transforms/Utils/SymbolRewriter.h Mon Jul
>>>> 25 13:10:54 2016
>>>> @@ -30,12 +30,11 @@
>>>>  //
>>>>
>>>>  //===----------------------------------------------------------------------===//
>>>>
>>>> -#ifndef LLVM_TRANSFORMS_UTILS_SYMBOL_REWRITER_H
>>>> -#define LLVM_TRANSFORMS_UTILS_SYMBOL_REWRITER_H
>>>> +#ifndef LLVM_TRANSFORMS_UTILS_SYMBOLREWRITER_H
>>>> +#define LLVM_TRANSFORMS_UTILS_SYMBOLREWRITER_H
>>>>
>>>> -#include "llvm/ADT/ilist.h"
>>>> -#include "llvm/ADT/ilist_node.h"
>>>>  #include "llvm/IR/Module.h"
>>>> +#include <list>
>>>>
>>>>  namespace llvm {
>>>>  class MemoryBuffer;
>>>> @@ -59,7 +58,7 @@ namespace SymbolRewriter {
>>>>  /// be rewritten or providing a (posix compatible) regular expression
>>>> that will
>>>>  /// select the symbols to rewrite.  This descriptor list is passed to
>>>> the
>>>>  /// SymbolRewriter pass.
>>>> -class RewriteDescriptor : public ilist_node<RewriteDescriptor> {
>>>> +class RewriteDescriptor {
>>>>    RewriteDescriptor(const RewriteDescriptor &) = delete;
>>>>
>>>>    const RewriteDescriptor &
>>>> @@ -86,7 +85,7 @@ private:
>>>>    const Type Kind;
>>>>  };
>>>>
>>>> -typedef iplist<RewriteDescriptor> RewriteDescriptorList;
>>>> +typedef std::list<std::unique_ptr<RewriteDescriptor>>
>>>> RewriteDescriptorList;
>>>>
>>>>  class RewriteMapParser {
>>>>  public:
>>>> @@ -110,43 +109,8 @@ private:
>>>>  };
>>>>  }
>>>>
>>>> -template <>
>>>> -struct ilist_traits<SymbolRewriter::RewriteDescriptor>
>>>> -    : public ilist_default_traits<SymbolRewriter::RewriteDescriptor> {
>>>> -  mutable ilist_half_node<SymbolRewriter::RewriteDescriptor> Sentinel;
>>>> -
>>>> -public:
>>>> -  // createSentinel is used to get a reference to a node marking the
>>>> end of
>>>> -  // the list.  Because the sentinel is relative to this instance, use
>>>> a
>>>> -  // non-static method.
>>>> -  SymbolRewriter::RewriteDescriptor *createSentinel() const {
>>>> -    // since i[p] lists always publicly derive from the corresponding
>>>> -    // traits, placing a data member in this class will augment the
>>>> -    // i[p]list.  Since the NodeTy is expected to publicly derive from
>>>> -    // ilist_node<NodeTy>, there is a legal viable downcast from it to
>>>> -    // NodeTy.  We use this trick to superpose i[p]list with a
>>>> "ghostly"
>>>> -    // NodeTy, which becomes the sentinel.  Dereferencing the sentinel
>>>> is
>>>> -    // forbidden (save the ilist_node<NodeTy>) so no one will ever
>>>> notice
>>>> -    // the superposition.
>>>> -    return static_cast<SymbolRewriter::RewriteDescriptor *>(&Sentinel);
>>>> -  }
>>>> -  void destroySentinel(SymbolRewriter::RewriteDescriptor *) {}
>>>> -
>>>> -  SymbolRewriter::RewriteDescriptor *provideInitialHead() const {
>>>> -    return createSentinel();
>>>> -  }
>>>> -
>>>> -  SymbolRewriter::RewriteDescriptor *
>>>> -  ensureHead(SymbolRewriter::RewriteDescriptor *&) const {
>>>> -    return createSentinel();
>>>> -  }
>>>> -
>>>> -  static void noteHead(SymbolRewriter::RewriteDescriptor *,
>>>> -                       SymbolRewriter::RewriteDescriptor *) {}
>>>> -};
>>>> -
>>>>  ModulePass *createRewriteSymbolsPass();
>>>>  ModulePass
>>>> *createRewriteSymbolsPass(SymbolRewriter::RewriteDescriptorList &);
>>>>  }
>>>>
>>>> -#endif
>>>> +#endif //LLVM_TRANSFORMS_UTILS_SYMBOLREWRITER_H
>>>>
>>>> Modified: llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp?rev=276668&r1=276667&r2=276668&view=diff
>>>>
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp (original)
>>>> +++ llvm/trunk/lib/Transforms/Utils/SymbolRewriter.cpp Mon Jul 25
>>>> 13:10:54 2016
>>>> @@ -361,9 +361,11 @@ parseRewriteFunctionDescriptor(yaml::Str
>>>>    // TODO see if there is a more elegant solution to selecting the
>>>> rewrite
>>>>    // descriptor type
>>>>    if (!Target.empty())
>>>> -    DL->push_back(new ExplicitRewriteFunctionDescriptor(Source,
>>>> Target, Naked));
>>>> +    DL->push_back(
>>>> +        make_unique<ExplicitRewriteFunctionDescriptor>(Source, Target,
>>>> Naked));
>>>>    else
>>>> -    DL->push_back(new PatternRewriteFunctionDescriptor(Source,
>>>> Transform));
>>>> +    DL->push_back(
>>>> +        make_unique<PatternRewriteFunctionDescriptor>(Source,
>>>> Transform));
>>>>
>>>>    return true;
>>>>  }
>>>> @@ -421,11 +423,12 @@ parseRewriteGlobalVariableDescriptor(yam
>>>>    }
>>>>
>>>>    if (!Target.empty())
>>>> -    DL->push_back(new ExplicitRewriteGlobalVariableDescriptor(Source,
>>>> Target,
>>>> -
>>>> /*Naked*/false));
>>>> +    DL->push_back(
>>>> +        make_unique<ExplicitRewriteGlobalVariableDescriptor>(Source,
>>>> Target,
>>>> +                                                             /*Naked*/
>>>> false));
>>>>    else
>>>> -    DL->push_back(new PatternRewriteGlobalVariableDescriptor(Source,
>>>> -
>>>>  Transform));
>>>> +    DL->push_back(
>>>> +        make_unique<PatternRewriteGlobalVariableDescriptor>(Source,
>>>> Transform));
>>>>
>>>>    return true;
>>>>  }
>>>> @@ -483,10 +486,12 @@ parseRewriteGlobalAliasDescriptor(yaml::
>>>>    }
>>>>
>>>>    if (!Target.empty())
>>>> -    DL->push_back(new ExplicitRewriteNamedAliasDescriptor(Source,
>>>> Target,
>>>> -
>>>> /*Naked*/false));
>>>> +    DL->push_back(
>>>> +        make_unique<ExplicitRewriteNamedAliasDescriptor>(Source,
>>>> Target,
>>>> +                                                         /*Naked*/
>>>> false));
>>>>    else
>>>> -    DL->push_back(new PatternRewriteNamedAliasDescriptor(Source,
>>>> Transform));
>>>> +    DL->push_back(
>>>> +        make_unique<PatternRewriteNamedAliasDescriptor>(Source,
>>>> Transform));
>>>>
>>>>    return true;
>>>>  }
>>>> @@ -524,7 +529,7 @@ bool RewriteSymbols::runOnModule(Module
>>>>
>>>>    Changed = false;
>>>>    for (auto &Descriptor : Descriptors)
>>>> -    Changed |= Descriptor.performOnModule(M);
>>>> +    Changed |= Descriptor->performOnModule(M);
>>>>
>>>>    return Changed;
>>>>  }
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>>
>>> --
>>> Mike
>>> Sent from phone
>>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160725/2d2b2692/attachment-0001.html>


More information about the llvm-commits mailing list