[llvm-dev] Longstanding failing tests - clang-tidy, MachO, Polly

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 23 11:07:38 PST 2020


So, for this test case:

extern "C" void shouldBeUnconditional();
extern "C" void shouldBeConditional();
extern "C" void otherCall();
void testFn(bool Bool1, bool Bool2) {
  Bool1 |= Bool2;
  shouldBeUnconditional();
  if (Bool1)
    shouldBeConditional();
  if (Bool2) {
    otherCall();
    if (Bool1)
      otherCall();
  }
}

MSVC generates this buggy asm:

$ cl -c -Fat.asm msvc-bool-bug.cpp -O2
Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28315 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

msvc-bool-bug.cpp

$ cat t.asm
...
; Line 6
call shouldBeUnconditional
; Line 8
call shouldBeConditional
...

There is no conditional branch between these two calls, but if both Bool1
and Bool2 are false, the second call should not execute.

I went to file the issue, but I suspect that this report is a duplicate:
https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html

I posted my repro there.

It's not clear if we should do anything in LLVM to work around the problem,
or if we should just wait for the next release.

On Thu, Jan 23, 2020 at 10:48 AM Reid Kleckner <rnk at google.com> wrote:

> The gen-dwarf* test failures actually seem like an MSVC compiler bug. This
> variable somehow gets folded to true with MSVC, and extra unexpected
> relocations are produced:
>
> https://github.com/llvm/llvm-project/blob/master/llvm/lib/MC/MCDwarf.cpp#L1141
>
> I will try to reduce it. I suspect it requires this specific MSVC release
> to reproduce, and our buildbots must not have it.
>
> On Tue, Jan 21, 2020 at 4:39 PM Alexandre Ganea via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hi,
>>
>>
>>
>> A few tests seem broken for a long time, some for more than a month.
>> Would it possible for respective owners to take a look please?
>>
>>
>>
>> I’m at checkout 133a7e631cee97965e310f0d110739217427fd3d, compiling on
>> Windows 10.
>>
>>
>>
>> These tests fail with Visual Studio 2019:
>>
>>
>>
>> Failing Tests (7):
>>
>>     Clang Tools :: clang-tidy/checkers/cert-mem57-cpp-cpp17.cpp
>>
>>     Clang Tools ::
>> clang-tidy/checkers/performance-noexcept-move-constructor-fix.cpp
>>
>>     LLVM :: MC/MachO/gen-dwarf-cpp.s
>>
>>     LLVM :: MC/MachO/gen-dwarf-macro-cpp.s
>>
>>     LLVM :: MC/MachO/gen-dwarf-producer.s
>>
>>     LLVM :: MC/MachO/gen-dwarf.s
>>
>>     Polly :: ScopInfo/memset_null.ll
>>
>>
>>
>>   Expected Passes    : 57692
>>
>>   Expected Failures  : 283
>>
>>   Unsupported Tests  : 1941
>>
>>   Unexpected Failures: 7
>>
>>
>>
>> The clang-tidy tests fail since end of November-December.
>>
>> The MachO tests fail since about the beginning of December.
>>
>> The Polly test fails since a few days ago.
>>
>> (see below for more info)
>>
>>
>>
>> I’m using the following cmake cmd-line:
>>
>>
>>
>> cmake -GNinja %ROOT%/llvm -DCMAKE_BUILD_TYPE=Release
>> -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_ASSERTIONS=ON
>> -DLLVM_ENABLE_LIBXML2=OFF
>> -DCMAKE_C_COMPILER="%VS2019%/bin/HostX64/x64/cl.EXE"
>> -DCMAKE_CXX_COMPILER="%VS2019%/bin/HostX64/x64/cl.EXE"
>> -DCMAKE_LINKER="%VS2019%/bin/HostX64/x64/link.EXE"
>> -DLLVM_ENABLE_PROJECTS="llvm;clang;lld;clang-tools-extra;compiler-rt;mlir;polly"
>> -DLLVM_ENABLE_PDB=ON -DLLVM_POLLY_LINK_INTO_TOOLS=ON
>>
>>
>>
>> These tests fail with Clang 9.0.1:
>>
>>
>>
>> Failing Tests (3):
>>
>>     Clang Tools :: clang-tidy/checkers/cert-mem57-cpp-cpp17.cpp
>>
>>     Clang Tools ::
>> clang-tidy/checkers/performance-noexcept-move-constructor-fix.cpp
>>
>>     Polly :: ScopInfo/memset_null.ll
>>
>>
>>
>>   Expected Passes    : 57727
>>
>>   Expected Failures  : 283
>>
>>   Unsupported Tests  : 1911
>>
>>   Unexpected Failures: 3
>>
>>
>>
>> 1 warning(s) in tests
>>
>>
>>
>> I’m using the following cmake cmd-line:
>>
>>
>>
>> cmake -GNinja %ROOT%/llvm -DCMAKE_BUILD_TYPE=Release
>> -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_ASSERTIONS=ON
>> -DLLVM_ENABLE_LIBXML2=OFF -DCMAKE_C_COMPILER="%LLVM%/bin/clang-cl.EXE"
>> -DCMAKE_CXX_COMPILER="%LLVM%/bin/clang-cl.EXE"
>> -DCMAKE_LINKER="%LLVM%/bin/lld-link.EXE"
>> -DLLVM_ENABLE_PROJECTS="llvm;clang;lld;clang-tools-extra;compiler-rt;mlir;polly"
>> -DLLVM_ENABLE_PDB=ON -DLLVM_POLLY_LINK_INTO_TOOLS=ON -DLLVM_ENABLE_LLD=ON
>>
>>
>>
>> Thanks in advance!
>>
>> Alex.
>>
>>
>> ------------------------------
>>
>>
>>
>> The clang-tidy cert-mem57 tests seem to be related to varying messages
>> (warning|error) being emitted.
>>
>>
>>
>> All three MachO/gen-dwarf test are crashing at about the same place:
>>
>> Stack dump:
>>
>> 0.      Program arguments:
>> d:\llvm-project\buildninjarelmsvc\bin\llvm-dwarfdump.exe -all
>> D:\llvm-project\buildninjaRelMSVC\test\MC\MachO\Output\gen-dwarf.s.tmp
>>
>> #0 0x00007ff6c125dfb8 llvm::DWARFCompileUnit::dump(class
>> llvm::raw_ostream &, struct llvm::DIDumpOptions)
>> D:\llvm-project\llvm\lib\DebugInfo\DWARF\DWARFCompileUnit.cpp:23:0
>>
>> #1 0x00007ff6c1236e18
>> <lambda_25ce692e137c1a998cd3557ebf29fa33>::operator()
>> D:\llvm-project\llvm\lib\DebugInfo\DWARF\DWARFContext.cpp:367:0
>>
>> #2 0x00007ff6c123968b llvm::DWARFContext::dump(class llvm::raw_ostream &,
>> struct llvm::DIDumpOptions, class std::array<class llvm::Optional<unsigned
>> __int64>, 28>)
>> D:\llvm-project\llvm\lib\DebugInfo\DWARF\DWARFContext.cpp:372:0
>>
>> #3 0x00007ff6c12197f8 dumpObjectFile
>> D:\llvm-project\llvm\tools\llvm-dwarfdump\llvm-dwarfdump.cpp:448:0
>>
>> #4 0x00007ff6c1218486 std::_Func_impl_no_alloc<bool (__cdecl *)(class
>> llvm::object::ObjectFile &, class llvm::DWARFContext &, class llvm::Twine,
>> class llvm::raw_ostream &), bool, class llvm::object::ObjectFile &, class
>> llvm::DWARFContext &, class llvm::Twine, class llvm::raw_ostream
>> &>::_Do_call(class llvm::object::ObjectFile &, class llvm::DWARFContext &,
>> class llvm::Twine &&, class llvm::raw_ostream &) C:\Program Files
>> (x86)\Microsoft Visual
>> Studio\2019\Professional\VC\Tools\MSVC\14.24.28314\include\functional:927:0
>>
>> #5 0x00007ff6c121c519 handleBuffer
>> D:\llvm-project\llvm\tools\llvm-dwarfdump\llvm-dwarfdump.cpp:495:0
>>
>> #6 0x00007ff6c121d16a handleFile
>> D:\llvm-project\llvm\tools\llvm-dwarfdump\llvm-dwarfdump.cpp:528:0
>>
>> #7 0x00007ff6c121eb87 main
>> D:\llvm-project\llvm\tools\llvm-dwarfdump\llvm-dwarfdump.cpp:643:0
>>
>> #8 0x00007ff6c16b6420 __scrt_common_main_seh
>> d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
>>
>> #9 0x00007ffb52557bd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x17bd4)
>>
>> #10 0x00007ffb5278ced1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6ced1)
>>
>>
>>
>> error: command failed with exit status: 3221225477
>>
>>
>>
>> Polly :: ScopInfo/memset_null.ll fails because the second opt fails:
>>
>> D:\llvm-project>buildninjarelmsvc\bin\opt  -polly-process-unprofitable
>> -polly-remarks-minimal  -polly-use-llvm-names
>> -polly-import-jscop-dir=D:\llvm-project\polly\test\ScopInfo
>> -polly-codegen-verify  -polly-allow-modref-calls -polly-scops -analyze <
>> D:\llvm-project\polly\test\ScopInfo\memset_null.ll
>>
>> Printing analysis 'Polly - Create polyhedral description of Scops' for
>> region: 'for.cond5.preheader.us221 => for.end68' in function 'test':
>>
>> Invalid Scop!
>>
>> Printing analysis 'Polly - Create polyhedral description of Scops' for
>> region: 'entry => for.end68' in function 'test':
>>
>> Invalid Scop!
>>
>> Printing analysis 'Polly - Create polyhedral description of Scops' for
>> region: 'entry => <Function Return>' in function 'test':
>>
>> Invalid Scop!
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200123/da6bac28/attachment.html>


More information about the llvm-dev mailing list