When a module contains more than one function, we should update debugify metadata
by increasing the number of variables in the function rather than overwritting it.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/CodeGen/MachineDebugify.cpp | ||
---|---|---|
165 | LGTM here | |
176 | Here is runOnModule not runOnFunction, so I think here should only has 1 "llvm.mir.debugify". |
llvm/lib/CodeGen/MachineDebugify.cpp | ||
---|---|---|
176 | Yeah, I did it a little wrong. So, the root cause is that we don't strip llvm.mir.debugify metadata. In this patch I suggest just checking that we do not forget to remove the old metadata when re-running the pass. And I'll create a fix to stripDebugifyMetadata to strip not only llvm.debugify but llvm.mir.debugify as well. |
llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir | ||
---|---|---|
1 | It is strange we check nothing, so how to judge this test is pass or not ? |
llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir | ||
---|---|---|
1 | We do check exit code. As you can see, we remove "xfail" in this patch. So, we had an assertion that is fixed by this patch: asi@asi:~/dev/sources/llvm-project-mainstream/build-release$ bin/llvm-lit ../llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir -a -- Testing: 1 tests, 1 workers -- XFAIL: LLVM :: CodeGen/Generic/MIRDebugify/multifunction-module.mir (1 of 1) Script: -- : 'RUN: at line 1'; /home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc -run-pass=mir-debugify,mir-check-debugify /home/asi/dev/sources/llvm-project-mainstream/llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir -- Exit Code: 134 Command Output (stderr): -- + : 'RUN: at line 1' + /home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc -run-pass=mir-debugify,mir-check-debugify /home/asi/dev/sources/llvm-project-mainstream/llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir llc: /home/asi/dev/sources/llvm-project-mainstream/llvm/lib/CodeGen/MachineCheckDebugify.cpp:84: virtual bool {anonymous}::CheckDebugMachineModule::runOnModule(llvm::Module&): Assertion `Var <= NumVars && "Unexpected name for DILocalVariable"' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: /home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc -run-pass=mir-debugify,mir-check-debugify /home/asi/dev/sources/llvm-project-mainstream/llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir 1. Running pass 'Machine Check Debug Module' on module '/home/asi/dev/sources/llvm-project-mainstream/llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir'. #0 0x00005586602463c5 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0 #1 0x0000558660243ab4 SignalHandler(int) Signals.cpp:0:0 #2 0x00007f74926dc520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #3 0x00007f7492730a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76 #4 0x00007f7492730a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10 #5 0x00007f7492730a7c pthread_kill ./nptl/pthread_kill.c:89:10 #6 0x00007f74926dc476 gsignal ./signal/../sysdeps/posix/raise.c:27:6 #7 0x00007f74926c27f3 abort ./stdlib/abort.c:81:7 #8 0x00007f74926c271b _nl_load_domain ./intl/loadmsgcat.c:1177:9 #9 0x00007f74926d3e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #10 0x000055865f25babf (anonymous namespace)::CheckDebugMachineModule::runOnModule(llvm::Module&) MachineCheckDebugify.cpp:0:0 #11 0x000055865f7e4415 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x5b83415) #12 0x000055865d3de27f compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0 #13 0x000055865d3df116 main (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x377e116) #14 0x00007f74926c3d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #15 0x00007f74926c3e40 call_init ./csu/../csu/libc-start.c:128:20 #16 0x00007f74926c3e40 __libc_start_main ./csu/../csu/libc-start.c:379:5 #17 0x000055865d3d1a25 _start (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x3770a25) /home/asi/dev/sources/llvm-project-mainstream/build-release/test/CodeGen/Generic/MIRDebugify/Output/multifunction-module.mir.script: line 1: 11064 Aborted (core dumped) /home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc -run-pass=mir-debugify,mir-check-debugify /home/asi/dev/sources/llvm-project-mainstream/llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir I can precommit the test if you want to run it. |
llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir | ||
---|---|---|
1 | Does this is standard way to check test ? I didn't see this way before. |
llvm/test/CodeGen/Generic/MIRDebugify/multifunction-module.mir | ||
---|---|---|
1 |
XFAIL can we used for this purpose. You might want to check test/CodeGen/AMDGPU/infinite-loop-evergreen.ll as an example: asi@asi:~/dev/sources/llvm-project-mainstream/build-release$ bin/llvm-lit ../llvm/test/CodeGen/AMDGPU/infinite-loop-evergreen.ll -a -- Testing: 1 tests, 1 workers -- XFAIL: LLVM :: CodeGen/AMDGPU/infinite-loop-evergreen.ll (1 of 1) Script: -- : 'RUN: at line 3'; /home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc -march=r600 -mcpu=cypress < /home/asi/dev/sources/llvm-project-mainstream/llvm/test/CodeGen/AMDGPU/infinite-loop-evergreen.ll | /home/asi/dev/sources/llvm-project-mainstream/build-release/bin/FileCheck /home/asi/dev/sources/llvm-project-mainstream/llvm/test/CodeGen/AMDGPU/infinite-loop-evergreen.ll -- Exit Code: 2 Command Output (stderr): -- error: no check strings found with prefix 'CHECK:' error: Extra register needed to handle CFG llc: /home/asi/dev/sources/llvm-project-mainstream/llvm/lib/Target/AMDGPU/R600MachineCFGStructurizer.cpp:1010: int {anonymous}::R600MachineCFGStructurizer::mergeLoop(llvm::MachineLoop*): Assertion `!ExitingMBBs.empty() && "Infinite Loop not supported"' failed. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: /home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc -march=r600 -mcpu=cypress 1. Running pass 'Function Pass Manager' on module '<stdin>'. 2. Running pass 'AMDGPU Control Flow Graph structurizer Pass' on function '@inf_loop_irreducible_cfg' #0 0x000055da349f63c5 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0 #1 0x000055da349f3ab4 SignalHandler(int) Signals.cpp:0:0 #2 0x00007fb1543cc520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #3 0x00007fb154420a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76 #4 0x00007fb154420a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10 #5 0x00007fb154420a7c pthread_kill ./nptl/pthread_kill.c:89:10 #6 0x00007fb1543cc476 gsignal ./signal/../sysdeps/posix/raise.c:27:6 #7 0x00007fb1543b27f3 abort ./stdlib/abort.c:81:7 #8 0x00007fb1543b271b _nl_load_domain ./intl/loadmsgcat.c:1177:9 #9 0x00007fb1543c3e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96) #10 0x000055da3222c3bf (anonymous namespace)::R600MachineCFGStructurizer::loopendPatternMatch() R600MachineCFGStructurizer.cpp:0:0 #11 0x000055da3222f524 (anonymous namespace)::R600MachineCFGStructurizer::runOnMachineFunction(llvm::MachineFunction&) R600MachineCFGStructurizer.cpp:0:0 #12 0x000055da33a39595 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0 #13 0x000055da33f938e3 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x5b828e3) #14 0x000055da33f93b19 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x5b82b19) #15 0x000055da33f94415 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x5b83415) #16 0x000055da31b8e27f compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0 #17 0x000055da31b8f116 main (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x377e116) #18 0x00007fb1543b3d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16 #19 0x00007fb1543b3e40 call_init ./csu/../csu/libc-start.c:128:20 #20 0x00007fb1543b3e40 __libc_start_main ./csu/../csu/libc-start.c:379:5 #21 0x000055da31b81a25 _start (/home/asi/dev/sources/llvm-project-mainstream/build-release/bin/llc+0x3770a25)
It's not as common as FileCheck, because usually we'd like to verify exact match with some pattern. However, sometimes it's OK to check just successful execution, e.g. CodeGen/AMDGPU/write-register-vgpr-into-sgpr.ll or CodeGen/X86/pr38038.ll. In general, I was able to grep ~1500 tests that check llc return code. |
Yes, We use XFAIL to mark a test as an expected failure. An XFAIL test will be successful if its execution fails, and will be a failure if its execution succeeds.
But now we are not expected failure. it is strange to test a test case by check nothing (only expect it not go to assert). I am not much sure about it.
@dsanders any suggestions ?
Let me auto-generate checks then? I don't think we really need them here, however, I'm not strongly against. If it's the only problem, it does not worth such a long discussion :)
I had to revert the change as I mistakenly forgot to strip the test from various x86 info such as regs, etc. So, almost all targets failed to run the test correctly. I'll update it soon.
LGTM here