[llvm-bugs] [Bug 46430] 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!"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 24 01:34:08 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46430

            Bug ID: 46430
           Summary: 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!"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 23642
  --> https://bugs.llvm.org/attachment.cgi?id=23642&action=edit
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 https://bugs.llvm.org/ 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: https://reviews.llvm.org/D81643

Found during fuzz testing, we don't normally use -costmodel-reduxcost

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200624/eaa7845d/attachment.html>


More information about the llvm-bugs mailing list