<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116061>116061</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[PowerPC] assert when compiler with `-disable-ppc-vsx-fma-mutation=false -mcpu=pwr10`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
diggerlin
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
diggerlin
</td>
</tr>
</table>
<pre>
reproduce:
bash> cat issue.ll
```
target datalayout = "E-m:a-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512"
target triple = "powerpc64-ibm-aix7.2.0.0"
define void @initial(<2 x double> %0) #0 {
entry:
%1 = fmul <2 x double> %0, zeroinitializer
br label %for.cond251.preheader.lr.ph
for.cond251.preheader.lr.ph: ; preds = %for.cond251.preheader.lr.ph, %entry
%2 = phi double [ %3, %for.cond251.preheader.lr.ph ], [ 0.000000e+00, %entry ]
%3 = phi double [ %7, %for.cond251.preheader.lr.ph ], [ 0.000000e+00, %entry ]
%add737 = fadd double %3, %2
%4 = insertelement <2 x double> zeroinitializer, double %add737, i64 0
%5 = fmul contract <2 x double> %4, zeroinitializer
%6 = fadd contract <2 x double> %1, %5
%7 = extractelement <2 x double> %6, i64 0
br label %for.cond251.preheader.lr.ph
}
```
bash> llc -disable-ppc-vsx-fma-mutation=false issue.ll -mtriple powerpc64-ibm-aix7.2.0.0 -mcpu=pwr10
```
llc: /home/zhijian/llvm/dev/digger-llvm-project/llvm/lib/CodeGen/VirtRegMap.cpp:421: bool (anonymous namespace)::VirtRegRewriter::readsUndefSubreg(const MachineOperand &) const: Assertion `SubRegIdx != 0 && LI.hasSubRanges()' 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/zhijian/llvm/dev/build1/bin/llc -disable-ppc-vsx-fma-mutation=false issue.ll -mtriple powerpc64-ibm-aix7.2.0.0 -mcpu=pwr10
1. Running pass 'Function Pass Manager' on module 'issue.ll'.
2. Running pass 'Virtual Register Rewriter' on function '@initial'
#0 0x000005e81c02edcc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/zhijian/llvm/dev/build1/bin/llc+0x77fedcc)
#1 0x000005e81c02f514 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#2 0x000005e81c02be80 llvm::sys::RunSignalHandlers() (/home/zhijian/llvm/dev/build1/bin/llc+0x77fbe80)
#3 0x000005e81c02f77c SignalHandler(int) Signals.cpp:0:0
#4 0x000074a2276704c8 (linux-vdso64.so.1+0x4c8)
#5 0x000074a226e3d168 __libc_signal_restore_set /build/glibc-GVyp00/glibc-2.31/signal/../sysdeps/unix/sysv/linux/internal-signals.h:86:3
#6 0x000074a226e3d168 raise /build/glibc-GVyp00/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:48:3
#7 0x000074a226e14850 abort /build/glibc-GVyp00/glibc-2.31/stdlib/abort.c:79:7
#8 0x000074a226e2c49c __assert_fail_base /build/glibc-GVyp00/glibc-2.31/assert/assert.c:92:3
#9 0x000074a226e2c540 __assert_fail /build/glibc-GVyp00/glibc-2.31/assert/assert.c:101:3
#10 0x000005e81b17d5e0 (anonymous namespace)::VirtRegRewriter::runOnMachineFunction(llvm::MachineFunction&) VirtRegMap.cpp:0:0
#11 0x000005e81ad7b04c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/zhijian/llvm/dev/build1/bin/llc+0x654b04c)
#12 0x000005e81b3f587c llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/zhijian/llvm/dev/build1/bin/llc+0x6bc587c)
#13 0x000005e81b3ffe48 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/zhijian/llvm/dev/build1/bin/llc+0x6bcfe48)
#14 0x000005e81b3f64e0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/zhijian/llvm/dev/build1/bin/llc+0x6bc64e0)
#15 0x000005e81b40042c llvm::legacy::PassManager::run(llvm::Module&) (/home/zhijian/llvm/dev/build1/bin/llc+0x6bd042c)
#16 0x000005e818b0d1a8 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#17 0x000005e818b0a6ac main (/home/zhijian/llvm/dev/build1/bin/llc+0x42da6ac)
#18 0x000074a226e14ccc generic_start_main /build/glibc-GVyp00/glibc-2.31/csu/../csu/libc-start.c:308:16
#19 0x000074a226e14ea4 __libc_start_main /build/glibc-GVyp00/glibc-2.31/csu/../sysdeps/unix/sysv/linux/powerpc/libc-start.c:98:10
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8mN1y4yoSx5-G3FBSIfTpC184yfjsVE3qpJLduXUhaMucg5AKUOLM02-BFNtyPk52sjOpGZWEoPvX0PxbmFkrGw2wRPklolTIpgGjpEaUovz6gg1u15nlofmi7sTTEpFrRFYGetOJgQNKV2PLeK2Z3aH0C-bMYWntALFSp-9RQaZ_4dEx04DDgjmm2FM3OIzSa4wo_RK1KF2xaC2LLJJFhtJVkUU6pePNfUKr6IHmBUpXh2v0kCf-_fFK6cyNM7JX8Oyi7x7B9Nzbr9uIyX0Z05jE5DBqvArYSg34oZMCo4xILZ1kCtEKpVcU77HohlqBjxnRnCC6wIimBKPychwP2pmnwyxh3ysJCNt2UPgNI1f4B5hu8iV_gHkeXRusWA3K99t2JuadFjRP4t7ADpgAEysT97vTAN7rlq4wSi9xb0DYaV7eNUuvfI8xpGM8NAztd3KKA6P80renU_93LGKUX4de-SUmMQl_gOglIae-Qq-jv_QNf-Uv8IdozoQo03JcMybEwekxQHoCl4WOUlswDhS0oN3LVT5fXXp1YnX059tkkWFyYjs_Jg7vtDOMv2LbM7yTQYjmxTGWd80kU3j5ydhxHmAfRr0Zn3fyIoD_LXfL61cV41lglOI4EtKyWkHU9zx6sPto27KoHRxzstMovd4yZeEgQzhqJwF4a-fjqOX9gNLr_tEk5B3ZUoqHrUPXu64FRNc_dvIvyTSia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