-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Description
This IR:
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"
define void @_Z1jiPA8_A8_sPi() {
entry:
br i1 false, label %for.cond3.preheader.lr.ph.split.us.us, label %for.cond3.preheader.lr.ph.split.us204
for.body10.us: ; preds = %for.cond3.preheader.us201, %for.body10.us
br i1 false, label %for.body10.us, label %for.body10.us.1
for.body10.us.1: ; preds = %for.body10.us.1, %for.body10.us
br i1 false, label %for.body10.us.1, label %for.cond3.preheader.us201
for.cond3.preheader.us201: ; preds = %for.cond3.preheader.lr.ph.split.us204, %for.body10.us.1
br label %for.body10.us
for.cond3.preheader.lr.ph.split.us204: ; preds = %entry
br label %for.cond3.preheader.us201
for.cond3.preheader.lr.ph.split.us.us: ; preds = %entry
ret void
}
Triggers this assert:
opt: /root/llvm-project/llvm/include/llvm/IR/Instructions.h:3135: llvm::Value* llvm::BranchInst::getCondition() const: Assertion `isConditional() && "Cannot get condition of an uncond branch!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=loop-fusion <source>
1. Running pass "function(loop-fusion)" on module "<source>"
2. Running pass "loop-fusion" on function "_Z1jiPA8_A8_sPi"
#0 0x0000000005989ef8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5989ef8)
#1 0x0000000005986da4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x000073df41242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000073df412969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000073df41242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000073df412287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x000073df4122871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x000073df41239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x0000000004ab7e13 (anonymous namespace)::ControlConditions::collectControlConditions(llvm::BasicBlock const&, llvm::BasicBlock const&, llvm::DominatorTree const&, llvm::PostDominatorTree const&, unsigned int) (.constprop.0) CodeMoverUtils.cpp:0:0
#9 0x0000000004ab8011 llvm::isControlFlowEquivalent(llvm::BasicBlock const&, llvm::BasicBlock const&, llvm::DominatorTree const&, llvm::PostDominatorTree const&) (.part.0) CodeMoverUtils.cpp:0:0
#10 0x00000000046ab5e9 llvm::LoopFusePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x46ab5e9)
when compiled with opt -passes=loop-fusion -S , see also:
https://godbolt.org/z/TWMbTh1xo
Reproduced from the C-code reprodrucer:
#include <algorithm>
int a, e, h, i;
char b, s, f, g;
short d;
extern char c[];
void j(int k, short l[][8][8], int m[]) {
for (int n;; n += 3) {
a = std::min(0, k ? m[n] : 0);
for (long o(f); o < 10; o += -803618435008038)
for (int p = 3; p < 13; p += 3) {
for (int q = 0; q < 4; q += e)
d = c[q] = 0;
for (; k < 4;) {
b = i ? l[3][3][6] : k;
for (; g;)
s = f;
}
}
for (char r; r < 7; r = h)
;
}
}