[llvm-bugs] [Bug 48812] New: opt crash with "-sroa -ipsccp -loop-unroll", Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 20 00:14:14 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48812
Bug ID: 48812
Summary: opt crash with "-sroa -ipsccp -loop-unroll", Assertion
`isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"' failed.
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: suochenyao at 163.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 24402
--> https://bugs.llvm.org/attachment.cgi?id=24402&action=edit
IR that is passed to opt
*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
long a=0;
unsigned b() {
int c = 40;
d:
for (; 0 >= 0;) {
long e=0;
c = 0;
if (a)
goto d;
return 0;
}
c;
}
int main() {}
*******************************************************************************
clang version:
$ clang -v
clang version 12.0.0 (/home/suocy/src/llvm-dev/llvm-project/llvm/tools/clang
daeea961a6d93f301e7a22659a2c203846fd58f2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/suocy/bin/llvm-dev/bin
Found candidate GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
*******************************************************************************
Command Lines:
$ clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm a.c -o a.bc
a.c:12:3: warning: expression result unused [-Wunused-value]
c;
^
1 warning generated.
$ opt -sroa -ipsccp -loop-unroll a.bc -o a.opt.bc
opt:
/home/suocy/src/llvm-dev/llvm-project/llvm/include/llvm/Support/Casting.h:269:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
llvm::BranchInst; Y = llvm::Instruction; typename llvm::cast_retty<X,
Y*>::ret_type = llvm::BranchInst*]: 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: /home/suocy/bin/llvm-dev/bin/opt -sroa -ipsccp
-loop-unroll a.bc -o a.opt.bc
1. Running pass 'Function Pass Manager' on module 'a.bc'.
2. Running pass 'Loop Pass Manager' on function '@b'
3. Running pass 'Unroll loops' on basic block '%d'
#0 0x0000000002aca95c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/suocy/bin/llvm-dev/bin/opt+0x2aca95c)
#1 0x0000000002ac88f4 llvm::sys::RunSignalHandlers()
(/home/suocy/bin/llvm-dev/bin/opt+0x2ac88f4)
#2 0x0000000002ac8a53 SignalHandler(int)
(/home/suocy/bin/llvm-dev/bin/opt+0x2ac8a53)
#3 0x00007fa247844630 __restore_rt (/lib64/libpthread.so.0+0xf630)
#4 0x00007fa246432387 raise (/lib64/libc.so.6+0x36387)
#5 0x00007fa246433a78 abort (/lib64/libc.so.6+0x37a78)
#6 0x00007fa24642b1a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
#7 0x00007fa24642b252 (/lib64/libc.so.6+0x2f252)
#8 0x0000000002b94a6c llvm::peelLoop(llvm::Loop*, unsigned int,
llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::DominatorTree*,
llvm::AssumptionCache*, bool) (/home/suocy/bin/llvm-dev/bin/opt+0x2b94a6c)
#9 0x0000000002ba3786 llvm::UnrollLoop(llvm::Loop*, llvm::UnrollLoopOptions,
llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::DominatorTree*,
llvm::AssumptionCache*, llvm::TargetTransformInfo const*,
llvm::OptimizationRemarkEmitter*, bool, llvm::Loop**)
(/home/suocy/bin/llvm-dev/bin/opt+0x2ba3786)
#10 0x00000000028cf5d3 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>)
(/home/suocy/bin/llvm-dev/bin/opt+0x28cf5d3)
#11 0x00000000028cfa51 (anonymous
namespace)::LoopUnroll::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/home/suocy/bin/llvm-dev/bin/opt+0x28cfa51)
#12 0x0000000001b5f4b3 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/suocy/bin/llvm-dev/bin/opt+0x1b5f4b3)
#13 0x00000000022d9538 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/suocy/bin/llvm-dev/bin/opt+0x22d9538)
#14 0x00000000022d9fd9 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/suocy/bin/llvm-dev/bin/opt+0x22d9fd9)
#15 0x00000000022d8de3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/suocy/bin/llvm-dev/bin/opt+0x22d8de3)
#16 0x0000000000724809 main (/home/suocy/bin/llvm-dev/bin/opt+0x724809)
#17 0x00007fa24641e555 __libc_start_main (/lib64/libc.so.6+0x22555)
#18 0x00000000007dcfc5 _start (/home/suocy/bin/llvm-dev/bin/opt+0x7dcfc5)
Aborted
--
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/20210120/6b21b85e/attachment.html>
More information about the llvm-bugs
mailing list