[lld] r265258 - [LTO] Implement -disable-verify, which disables bitcode verification.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 10:47:35 PDT 2016


I think that is a mistake, so I fixed it in r265316.

On Sun, Apr 3, 2016 at 10:54 AM, Rui Ueyama <ruiu at google.com> wrote:

> On Sat, Apr 2, 2016 at 8:39 PM, Davide Italiano via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: davide
>> Date: Sat Apr  2 22:39:09 2016
>> New Revision: 265258
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=265258&view=rev
>> Log:
>> [LTO] Implement -disable-verify, which disables bitcode verification.
>>
>> So, there are some cases when the IR Linker produces a broken
>> module (which doesn't pass the verifier) and we end up asserting
>> inside the verifier. I think it's always a bug producing a module
>> which does not pass the verifier but there are some cases in which
>> people can live with the broken module (e.g. if only DebugInfo
>> metadata are broken). The gold plugin has something similar.
>>
>> This commit is motivated by a situation I found in the
>> wild. It seems that somebody else discovered it independently
>> and reported in PR24923.
>>
>> Added:
>>     lld/trunk/test/ELF/lto/verify-invalid.ll
>> Modified:
>>     lld/trunk/ELF/Config.h
>>     lld/trunk/ELF/Driver.cpp
>>     lld/trunk/ELF/LTO.cpp
>>     lld/trunk/ELF/Options.td
>>
>> Modified: lld/trunk/ELF/Config.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=265258&r1=265257&r2=265258&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Config.h (original)
>> +++ lld/trunk/ELF/Config.h Sat Apr  2 22:39:09 2016
>> @@ -56,6 +56,7 @@ struct Configuration {
>>    bool BsymbolicFunctions;
>>    bool BuildId;
>>    bool Demangle = true;
>> +  bool DisableVerify;
>>    bool DiscardAll;
>>    bool DiscardLocals;
>>    bool DiscardNone;
>>
>> Modified: lld/trunk/ELF/Driver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=265258&r1=265257&r2=265258&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Driver.cpp (original)
>> +++ lld/trunk/ELF/Driver.cpp Sat Apr  2 22:39:09 2016
>> @@ -270,6 +270,7 @@ void LinkerDriver::readConfigs(opt::Inpu
>>    Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions);
>>    Config->BuildId = Args.hasArg(OPT_build_id);
>>    Config->Demangle = !Args.hasArg(OPT_no_demangle);
>> +  Config->DisableVerify = Args.hasArg(OPT_disable_verify);
>>    Config->DiscardAll = Args.hasArg(OPT_discard_all);
>>    Config->DiscardLocals = Args.hasArg(OPT_discard_locals);
>>    Config->DiscardNone = Args.hasArg(OPT_discard_none);
>>
>> Modified: lld/trunk/ELF/LTO.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=265258&r1=265257&r2=265258&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/LTO.cpp (original)
>> +++ lld/trunk/ELF/LTO.cpp Sat Apr  2 22:39:09 2016
>> @@ -59,8 +59,7 @@ static void runLTOPasses(Module &M, Targ
>>    PassManagerBuilder PMB;
>>    PMB.LibraryInfo = new
>> TargetLibraryInfoImpl(Triple(TM.getTargetTriple()));
>>    PMB.Inliner = createFunctionInliningPass();
>> -  PMB.VerifyInput = true;
>> -  PMB.VerifyOutput = true;
>> +  PMB.VerifyInput = PMB.VerifyOutput = !Config->DisableVerify;
>>
>
> nit: I'd write it in two lines.
>
>    PMB.LoopVectorize = true;
>>    PMB.SLPVectorize = true;
>>    PMB.OptLevel = Config->LtoO;
>>
>> Modified: lld/trunk/ELF/Options.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=265258&r1=265257&r2=265258&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/Options.td (original)
>> +++ lld/trunk/ELF/Options.td Sat Apr  2 22:39:09 2016
>> @@ -217,5 +217,6 @@ def G : Separate<["-"], "G">;
>>  def alias_version_script_version_script : Joined<["--"],
>> "version-script=">, Alias<version_script>;
>>
>>  // Debugging/developer options
>> +def disable_verify : Flag<["-"], "disable-verify">;
>>  def save_temps : Flag<["-"], "save-temps">;
>>  def mllvm : Separate<["-"], "mllvm">;
>>
>> Added: lld/trunk/test/ELF/lto/verify-invalid.ll
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/verify-invalid.ll?rev=265258&view=auto
>>
>> ==============================================================================
>> --- lld/trunk/test/ELF/lto/verify-invalid.ll (added)
>> +++ lld/trunk/test/ELF/lto/verify-invalid.ll Sat Apr  2 22:39:09 2016
>> @@ -0,0 +1,14 @@
>> +; REQUIRES: x86
>> +; RUN: llvm-as %s -o %t.o
>> +; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2 -mllvm  -disable-verify \
>> +; RUN:   -debug-pass=Arguments 2>&1 | FileCheck %s
>>
>
> "-debug-pass=Arguments" is the argument for -mllvm, and -disable-verify is
> the parameter interpreted by LLD. But -disable-verify is in between -mllvm
> and its argument. How does it work?
>
> +
>> +target triple = "x86_64-unknown-linux-gnu"
>> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
>> +
>> +define void @_start() {
>> +  ret void
>> +}
>> +
>> +; -disable-verify should disable the verification of bitcode.
>> +; CHECK-NOT: Pass Arguments: {{.*}} -verify {{.*}} -verify
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160404/c881363c/attachment.html>


More information about the llvm-commits mailing list