Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

After 7ab05d9a60b, Assertion failed: (&*It == &StartMI && "No new def between StartMI and EndMI."), function fixupIsDeadOrKill, file llvm/lib/Target/PowerPC/PPCInstrInfo.cpp, line 2715. #46010

Closed Quuxplusone closed 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR47041
Status RESOLVED FIXED
Importance P normal
Reported by Dimitry Andric (dimitry@andric.com)
Reported on 2020-08-07 13:27:40 -0700
Last modified on 2020-08-18 02:53:33 -0700
Version 11.0
Hardware Other All
CC czhengsz@cn.ibm.com, hans@chromium.org, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, qshanz@cn.ibm.com
Fixed by commit(s)
Attachments
Blocks PR46725
Blocked by
See also
After https://reviews.llvm.org/rG7ab05d9a60b / https://reviews.llvm.org/D81723
("[PowerPC] fold addi's imm operand to its imm form consumer's displacement"),
building clang/lib/Serialization/ASTReader.cpp for target powerpc-unknown-
freebsd13.0 crashes with:

ssertion failed: (&*It == &StartMI && "No new def between StartMI and EndMI."),
function fixupIsDeadOrKill, file /home/dim/src/llvm/llvm-
project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp, line 2715.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/dim/ins/llvmorg-11-init-18635-
g7ab05d9a60b/bin/clang -cc1 -triple powerpc-unknown-freebsd13.0 -emit-obj -
disable-free -main-file-name ASTReader.cpp -mrelocation-model static -mframe-
pointer=none -fno-rounding-math -mconstructor-aliases -munwind-tables -target-
cpu ppc -target-feature +secure-plt -mfloat-abi hard -fno-split-dwarf-inlining -
debug-info-kind=line-tables-only -dwarf-version=4 -debugger-tuning=gdb -
ffunction-sections -fdata-sections -sys-header-deps -D CLANG_ENABLE_ARCMT -D
CLANG_ENABLE_STATIC_ANALYZER -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -
D __STDC_LIMIT_MACROS -D HAVE_VCS_VERSION_INC -D
LLVM_DEFAULT_TARGET_TRIPLE="powerpc-unknown-freebsd13.0" -D
LLVM_HOST_TRIPLE="powerpc-unknown-freebsd13.0" -D DEFAULT_SYSROOT="" -D
LLVM_TARGET_ENABLE_AARCH64 -D LLVM_TARGET_ENABLE_ARM -D LLVM_TARGET_ENABLE_MIPS
-D LLVM_TARGET_ENABLE_POWERPC -D LLVM_TARGET_ENABLE_RISCV -D
LLVM_TARGET_ENABLE_X86 -D LLVM_NATIVE_ASMPARSER=LLVMInitializePowerPCAsmParser -
D LLVM_NATIVE_ASMPRINTER=LLVMInitializePowerPCAsmPrinter -D
LLVM_NATIVE_DISASSEMBLER=LLVMInitializePowerPCDisassembler -D
LLVM_NATIVE_TARGET=LLVMInitializePowerPCTarget -D
LLVM_NATIVE_TARGETINFO=LLVMInitializePowerPCTargetInfo -D
LLVM_NATIVE_TARGETMC=LLVMInitializePowerPCTargetMC -O2 -Wno-format-zero-length -
Wno-c++11-extensions -std=c++14 -fdeprecated-macro -ferror-limit 19 -stack-
protector 2 -fno-rtti -fno-signed-char -fgnuc-version=4.2.1 -vectorize-loops -
vectorize-slp -faddrsig -x c++ ASTReader-eb69c1.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'ASTReader-eb69c1.cpp'.
4.      Running pass 'PowerPC MI Peephole Optimization' on function
'@_ZN5clang9ASTReader16ReadVersionTupleERKN4llvm11SmallVectorIyLj64EEERj'
#0 0x0000000002fc8688 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dim/ins/llvmorg-11-init-18635-g7ab05d9a60b/bin/clang+0x2fc8688)
#1 0x0000000002fc64e8 llvm::sys::RunSignalHandlers() (/home/dim/ins/llvmorg-11-
init-18635-g7ab05d9a60b/bin/clang+0x2fc64e8)
#2 0x0000000002fc8de6 SignalHandler(int) (/home/dim/ins/llvmorg-11-init-18635-
g7ab05d9a60b/bin/clang+0x2fc8de6)
#3 0x00000008055d6a30 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3

The full cpp file is ~13M and a preprocessed version is ~7.5M, so I am reducing
test case now.

In any case, llvmorg-11-init-18634-gc8fae2bb4af compiles this successfully,
while llvmorg-11-init-18635-g7ab05d9a60b asserts.
Quuxplusone commented 4 years ago
Minimized test case:

// clang -cc1 -triple powerpc-- -S -O2 ASTReader-min.cpp
class a {
public:
  using b = int;
  int operator[](b) const;
};
struct c {
  int e : 32;
  int d : 31;
  int g : 1;
  int : 31;
  int f;
  c() : e(f), d(), g(1) {}
  c(int p1) : e(p1) {}
};
struct h {
  using i = a;
  c j(const i &, unsigned &);
};
c h::j(const i &p1, unsigned &k) {
  int l = p1[1];
  if (l)
    return c();
  return k;
}
Quuxplusone commented 4 years ago

https://reviews.llvm.org/D83365 should resolve this issue. I verified with the latest clang code base, there is no assertions. What can I do to solve this on release branch V11.0? Thanks

Quuxplusone commented 4 years ago
(In reply to Chen Zheng (陈 正) from comment #2)
> https://reviews.llvm.org/D83365 should resolve this issue. I verified with
> the latest clang code base, there is no assertions. What can I do to solve
> this on release branch V11.0? Thanks

opps, this is a wrong comment. This issue asserts at a different place.
Quuxplusone commented 4 years ago
(In reply to Chen Zheng (陈 正) from comment #2)
> https://reviews.llvm.org/D83365 should resolve this issue. I verified with
> the latest clang code base, there is no assertions. What can I do to solve
> this on release branch V11.0? Thanks

I tried with 36f9fe2d349, but it still asserts for me, both with the minimized
test case, and the original test case:

$ ~/ins/llvmorg-12-init-00698-g36f9fe2d349/bin/clang -cc1 -triple powerpc-- -S -
O2 ASTReader-min.cpp
ASTReader-min.cpp:13:11: warning: field 'f' is uninitialized when used here [-
Wuninitialized]
  c() : e(f), d(), g(1) {}
          ^
Assertion failed: (&*It == &StartMI && "No new def between StartMI and
EndMI."), function fixupIsDeadOrKill, file /home/dim/src/llvm/llvm-
project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp, line 2737.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/dim/ins/llvmorg-12-init-00698-
g36f9fe2d349/bin/clang -cc1 -triple powerpc-- -S -O2 ASTReader-min.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'ASTReader-min.cpp'.
4.      Running pass 'PowerPC MI Peephole Optimization' on function
'@_ZN1h1jERK1aRj'
#0 0x00000000030e7e58 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dim/ins/llvmorg-12-init-00698-g36f9fe2d349/bin/clang+0x30e7e58)
#1 0x00000000030e5cb8 llvm::sys::RunSignalHandlers() (/home/dim/ins/llvmorg-12-
init-00698-g36f9fe2d349/bin/clang+0x30e5cb8)
#2 0x00000000030e85b6 SignalHandler(int) (/home/dim/ins/llvmorg-12-init-00698-
g36f9fe2d349/bin/clang+0x30e85b6)
#3 0x0000000805825a30 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
Abort trap

I'll see what happens with the very latest git master as of today (2020-08-10).
Quuxplusone commented 4 years ago
(In reply to Dimitry Andric from comment #4)
> I'll see what happens with the very latest git master as of today
> (2020-08-10).

It still asserts with 4f9f4b21e07 (aka llvmorg-12-init-02663-g4f9f4b21e07).
Quuxplusone commented 4 years ago
Yes, I found the same assertion like yours.
I am working on a fix now
Quuxplusone commented 4 years ago

https://reviews.llvm.org/D85659 is created for this issue.

Quuxplusone commented 4 years ago
(In reply to Chen Zheng (陈 正) from comment #7)
> https://reviews.llvm.org/D85659 is created for this issue.

That landed, and I've also pushed it to 11.x as
8cf2c031632f88a44eea68b48235496cf1c5d6ec. Please let me know if there are any
follow-ups.