<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64938>64938</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Potential incorrect modification status in X86 CodeGenPrepare
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:X86
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
boomanaiden154
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
boomanaiden154
</td>
</tr>
</table>
<pre>
While working on [https://reviews.llvm.org/D158250](https://reviews.llvm.org/D158250) I found this test failure when running `check-llvm` with `-DLLVM_ENABLE_EXPENSIVE_CHECKS=ON`:
```
-- Testing: 1 tests, 1 workers --
FAIL: LLVM :: CodeGen/X86/statepoint-stack-usage.ll (1 of 1)
******************** TEST 'LLVM :: CodeGen/X86/statepoint-stack-usage.ll' FAILED ********************
Script:
--
: 'RUN: at line 1'; /tmp/llvm-expensive-checks/bin/llc -verify-machineinstrs -stack-symbol-ordering=0 < /tmp/llvm-project/llvm/test/CodeGen/X86/statepoint-stack-usage.ll | /tmp/llvm-expensive-checks/bin/FileCheck /tmp/llvm-project/llvm/test/CodeGen/X86/statepoint-stack-usage.ll
--
Exit Code: 2
Command Output (stderr):
--
+ : 'RUN: at line 1'
+ /tmp/llvm-expensive-checks/bin/llc -verify-machineinstrs -stack-symbol-ordering=0
+ /tmp/llvm-expensive-checks/bin/FileCheck /tmp/llvm-project/llvm/test/CodeGen/X86/statepoint-stack-usage.ll
Pass modifies its input and doesn't report it: CodeGen Prepare
Pass modifies its input and doesn't report it
UNREACHABLE executed at /tmp/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1441!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /tmp/llvm-expensive-checks/bin/llc -verify-machineinstrs -stack-symbol-ordering=0
1. Running pass 'Function Pass Manager' on module '<stdin>'.
2. Running pass 'CodeGen Prepare' on function '@back_to_back_calls'
#0 0x00005555580db4c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/tmp/llvm-expensive-checks/bin/llc+0x2b874c8)
#1 0x00005555580d8f7e llvm::sys::RunSignalHandlers() (/tmp/llvm-expensive-checks/bin/llc+0x2b84f7e)
#2 0x00005555580dbca8 SignalHandler(int) Signals.cpp:0:0
#3 0x0000155554fd9520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000015555502da7c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x96a7c)
#5 0x0000155554fd9476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x0000155554fbf7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x0000555558038700 llvm::install_out_of_memory_new_handler() (/tmp/llvm-expensive-checks/bin/llc+0x2ae4700)
#8 0x0000555557922b42 (/tmp/llvm-expensive-checks/bin/llc+0x23ceb42)
#9 0x000055555792b232 llvm::FPPassManager::runOnModule(llvm::Module&) (/tmp/llvm-expensive-checks/bin/llc+0x23d7232)
#10 0x00005555579233fa llvm::legacy::PassManagerImpl::run(llvm::Module&) (/tmp/llvm-expensive-checks/bin/llc+0x23cf3fa)
#11 0x0000555556a5e757 main (/tmp/llvm-expensive-checks/bin/llc+0x150a757)
#12 0x0000155554fc0d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#13 0x0000155554fc0e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#14 0x0000555556a58c65 _start (/tmp/llvm-expensive-checks/bin/llc+0x1504c65)
FileCheck error: '<stdin>' is empty.
FileCheck command line: /tmp/llvm-expensive-checks/bin/FileCheck /tmp/llvm-project/llvm/test/CodeGen/X86/statepoint-stack-usage.ll
--
********************
********************
Failed Tests (1):
LLVM :: CodeGen/X86/statepoint-stack-usage.ll
```
It seems like somewhere the modification status is getting set incorrectly within that pass and this test case exposes the case where that happens (but it's also very possible that my code in the patch isn't handling something correctly). I'll try and take a look in a bit if I have a chance.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WF1z4joS_TXipQtKlj954CEfsJPaTCaVzL07b5Qst7E2tuSS5CT8-y3ZDsHs3N0JM3MpQkCWT5_u02q1zK2VO4W4IvElYSzXuuGKywJVEEeEMRJfz3jnKm1W02uzXBf71b8qWSO8aPMk1Q60AhJfVs61loQXhG0I2xh8lvhiF3X93Cy02RG2uQ7ijMWUxNeEZT88my3hBkrdqQJcJS04tA5KLuvOILxUqMB0SnkaJKGiQvE09ygkofAiXeVH59e3t39-3q7vLi5v19v1t_v13ePNn-vt1af11T8fSXj95Y4k1JOh14S-fSZ0fPc_53P4itZJtSPhBQQ9DUvYFQR9GNBYmM-HqZuLm1s_yRsFjxpewJUu8B-oCNt8yxLCNtZxh62Wys2t4-Jp3lm-w0VdA2FZALqEgLDlyISd_4av68evQFh6FhnCUvDerK_hZ0gMbjwKI1t3iPJbtDwhwtKHP-78N-6glgq99ykJL4GwjWtawjZe0zm-tqisfMZ5L7QlbJNL1V8VMH9GI8v9vOGikgqlss6LMnhk902u67k2BZpew2sKJLw6wW-N_jcKN_7019D6Xx9QLz3F_EvOG1njlR_61SSm8V2_Stcr7sPLhrEr3TRcFfClc23nfMpZV6AxPuX-Sx92Cf9Do_c5v0-pDxv5zaG959ZCowtZSrQgnQWpfBx9SAuNVhGWOjDYauNAuqMlB_cGW27wPJz-pj_uHtYXV598KQN8RdE5LLwk_8fTWuaEbW4eCNvc4o6LvTf-mSu-Q7MQbUvCiyCKAsKCkdvt-uJxDbbLG-mAQ97t3pg4DdPqvZOu6vKF0M2RvSkLaW2HXqDeOalE3RUIrkIQhtsKci6enOECF2Ox8GGHomvaQ0LSBfSve6N3hjfAza5rUDk7ZOdvzr5gtP4wbjat146wdNMp4aRW0Is5BtTXTa28tF2N0JeyK-sKqUi4JiwdfWR_AXmaKwNY-WbIw0XUB2zr9Lb_L3hd28NqBMJCCvSVUkpj_8pokUcig16afguwezt8uTdSuT7YX330CcveJxn-stXW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