<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - opt -loop-unroll -costmodel-reduxcost crashing with ./include/llvm/Support/Casting.h:269: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::Value]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!""
href="https://bugs.llvm.org/show_bug.cgi?id=46430">46430</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>opt -loop-unroll -costmodel-reduxcost crashing with ./include/llvm/Support/Casting.h:269: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::Value]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Global Analyses
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mikael.holmen@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=23642" name="attach_23642" title="bbi-44470.ll reproducer">attachment 23642</a> <a href="attachment.cgi?id=23642&action=edit" title="bbi-44470.ll reproducer">[details]</a></span>
bbi-44470.ll reproducer
Reproduce with:
opt -loop-unroll -costmodel-reduxcost -S -o - bbi-44470.ll
Result:
opt: ../include/llvm/Support/Casting.h:269: typename cast_retty<X, Y
*>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::Value]:
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0. Program arguments: build-all-builtins/bin/opt -loop-unroll
-costmodel-reduxcost -S -o - bbi-44470.ll
1. Running pass 'Function Pass Manager' on module 'bbi-44470.ll'.
2. Running pass 'Loop Pass Manager' on function '@g'
3. Running pass 'Unroll loops' on basic block '%f.exit'
#0 0x000000000451dd34 PrintStackTraceSignalHandler(void*)
(build-all-builtins/bin/opt+0x451dd34)
#1 0x000000000451b85e llvm::sys::RunSignalHandlers()
(build-all-builtins/bin/opt+0x451b85e)
#2 0x000000000451e04c SignalHandler(int)
(build-all-builtins/bin/opt+0x451e04c)
#3 0x00007f40a6237890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007f40a4ce0e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f40a4ce2801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f40a4cd239a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#7 0x00007f40a4cd2412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#8 0x000000000376746d (build-all-builtins/bin/opt+0x376746d)
#9 0x0000000003766eca
llvm::TargetTransformInfo::matchPairwiseReduction(llvm::ExtractElementInst
const*, unsigned int&, llvm::VectorType*&)
(build-all-builtins/bin/opt+0x3766eca)
#10 0x0000000003298199
llvm::TargetTransformInfoImplCRTPBase<llvm::X86TTIImpl>::getUserCost(llvm::User
const*, llvm::ArrayRef<llvm::Value const*>,
llvm::TargetTransformInfo::TargetCostKind)
(build-all-builtins/bin/opt+0x3298199)
#11 0x0000000003765ead llvm::TargetTransformInfo::getUserCost(llvm::User
const*, llvm::ArrayRef<llvm::Value const*>,
llvm::TargetTransformInfo::TargetCostKind) const
(build-all-builtins/bin/opt+0x3765ead)
#12 0x000000000355ffb8 llvm::TargetTransformInfo::getUserCost(llvm::User
const*, llvm::TargetTransformInfo::TargetCostKind) const
(build-all-builtins/bin/opt+0x355ffb8)
#13 0x0000000003560f05 llvm::CodeMetrics::analyzeBasicBlock(llvm::BasicBlock
const*, llvm::TargetTransformInfo const&, llvm::SmallPtrSetImpl<llvm::Value
const*> const&) (build-all-builtins/bin/opt+0x3560f05)
#14 0x00000000043143a2 tryToUnrollLoop(llvm::Loop*, llvm::DominatorTree&,
llvm::LoopInfo*, llvm::ScalarEvolution&, llvm::TargetTransformInfo const&,
llvm::AssumptionCache&, llvm::OptimizationRemarkEmitter&,
llvm::BlockFrequencyInfo*, llvm::ProfileSummaryInfo*, bool, int, bool, bool,
llvm::Optional<unsigned int>, llvm::Optional<unsigned int>,
llvm::Optional<bool>, llvm::Optional<bool>, llvm::Optional<bool>,
llvm::Optional<bool>, llvm::Optional<bool>, llvm::Optional<unsigned int>)
(build-all-builtins/bin/opt+0x43143a2)
#15 0x0000000004317ccd (anonymous
namespace)::LoopUnroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(build-all-builtins/bin/opt+0x4317ccd)
#16 0x000000000365775b llvm::LPPassManager::runOnFunction(llvm::Function&)
(build-all-builtins/bin/opt+0x365775b)
#17 0x0000000003d7ad54 llvm::FPPassManager::runOnFunction(llvm::Function&)
(build-all-builtins/bin/opt+0x3d7ad54)
#18 0x0000000003d7b028 llvm::FPPassManager::runOnModule(llvm::Module&)
(build-all-builtins/bin/opt+0x3d7b028)
#19 0x0000000003d7b67d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(build-all-builtins/bin/opt+0x3d7b67d)
#20 0x00000000024f1735 main (build-all-builtins/bin/opt+0x24f1735)
#21 0x00007f40a4cc3b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#22 0x00000000024db02a _start (build-all-builtins/bin/opt+0x24db02a)
Abort (core dumped)
This starts happening with 51541c068a83:
[CostModel] Unify ExtractElement cost.
Move the cost modelling, with the reduction pattern matching, from
getInstructionThroughput into generic TTIImpl::getUserCost. The
modelling in the AMDGPU backend can now be removed.
Differential Revision: <a href="https://reviews.llvm.org/D81643">https://reviews.llvm.org/D81643</a>
Found during fuzz testing, we don't normally use -costmodel-reduxcost</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>