<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55363>55363</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Assertion `getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mikaelholmen
</td>
</tr>
</table>
<pre>
llvm commit: beeed0994e
Reproduce with: opt -passes=instcombine -o /dev/null bbi-69431.ll
Result:
opt: ../include/llvm/IR/Instructions.h:1191: void llvm::ICmpInst::AssertOK(): Assertion `getOperand(0)->getType() == getOperand(1)->getType() && "Both operands to ICmp instruction are not of the same type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: build-all/bin/opt -passes=instcombine -o /dev/null /home/uabelho/bbi-69431.ll
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
build-all/bin/opt(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x23)[0x2cc6af3]
build-all/bin/opt(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x2cc476e]
build-all/bin/opt[0x2cc6e76]
/lib64/libpthread.so.0(+0xf630)[0x7f1552c6a630]
/lib64/libc.so.6(gsignal+0x37)[0x7f15503b1387]
/lib64/libc.so.6(abort+0x148)[0x7f15503b2a78]
/lib64/libc.so.6(+0x2f1a6)[0x7f15503aa1a6]
/lib64/libc.so.6(+0x2f252)[0x7f15503aa252]
build-all/bin/opt[0xc955d2]
build-all/bin/opt[0x276e8f1]
build-all/bin/opt[0x278df68]
build-all/bin/opt[0x26f8a4f]
build-all/bin/opt[0x26fc0c2]
build-all/bin/opt(_ZN4llvm15InstCombinePass3runERNS_8FunctionERNS_15AnalysisManagerIS1_JEEE+0x42e)[0x26fa82e]
build-all/bin/opt[0x301509d]
build-all/bin/opt(_ZN4llvm11PassManagerINS_8FunctionENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x205)[0x247d425]
build-all/bin/opt[0xb0b74d]
build-all/bin/opt(_ZN4llvm27ModuleToFunctionPassAdaptor3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0x29a)[0x248182a]
build-all/bin/opt[0xb0b52d]
build-all/bin/opt(_ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x208)[0x247c5b8]
build-all/bin/opt(_ZN4llvm15runPassPipelineENS_9StringRefERNS_6ModuleEPNS_13TargetMachineEPNS_21TargetLibraryInfoImplEPNS_14ToolOutputFileES8_S8_S0_NS_8ArrayRefIS0_EENS9_INS_10PassPluginEEENS_8opt_tool10OutputKindENSD_12VerifierKindEbbbbb+0x3f9f)[0x78b52f]
build-all/bin/opt(main+0x3fbf)[0x79c28f]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f155039d555]
build-all/bin/opt[0x785e70]
Abort
This starts happening with commit 30a12f3f63:
[InstCombine] Fix GEP with same index comparison with opaque pointers
We need to also check that the source element type is the same,
otherwise the indices may have different meaning. The added
addrspacecast demonstrates that we do still need to check the
pointer type.
but if compiling that commit we also need to pass -opaque-pointers=1 to opt.
[bbi-69431.ll.gz](https://github.com/llvm/llvm-project/files/8658646/bbi-69431.ll.gz)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVV99z2jgQ_mvgRQNjyz-wH3igDbnmmrRMYHpzffHI9hp0tS2fJCelf_3tygGStHPQ3tNlCMby7refdlfS51yV-3ldPzSsUE0j7ShYsBwASi9NQxh5VyNvcQ-dVmVfAHuUdkcWqrNs0gljwIyCK9kai965bIFNFBvx6xIe8Lvt65rluZzEaRj407oe4A6gpq8p3HCLiAQ8naKfbIu6LwF_ETG83NzTF0bRfWGlas2UWPh-6pPPg5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