Hi folks,
I’m hitting the below assertion failure when compiling this small piece of C code (repro.c, attached).
My command line is:
bin/clang --target=aarch64-linux-gnu -c -O2 repro.c
clang is built from top of trunk as of this morning. It only happens at -O2, and it doesn’t happen with the default target (x86_64). I tried to reproduce using just ‘llc -O2’ but didn’t manage – but I do have this reduced opt command line (repro.ll also attached, just generated from repro.c at -O0):
bin/opt -instcombine -licm -simplifycfg -instcombine -loop-rotate -loop-vectorize -instcombine < repro.ll
The failure is:
opt: /scratch/1/ismail/llvm-upstream/include/llvm/ADT/APInt.h:983: bool llvm::APInt::operator==(const llvm::APInt&) const: Assertion `BitWidth == RHS.BitWidth && “Comparison requires equal bit widths”’ failed.
…snip…
#8 0x00000000013a8553 llvm::APInt::operator==(llvm::APInt const&) const /scratch/1/ismail/llvm-upstream/include/llvm/ADT/APInt.h:984:0
#9 0x0000000001f875b0 simplifySelectBitTest(llvm::Value*, llvm::Value*, llvm::Value*, llvm::APInt const*, bool) /scratch/1/ismail/llvm-upstream/lib/Analysis/InstructionSimplify.cpp:3388:0
#10 0x0000000001f87ad5 simplifySelectWithICmpCond(llvm::Value*, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) /scratch/1/ismail/llvm-upstream/lib/Analysis/InstructionSimplify.cpp:3434:0
#11 0x0000000001f87f6a SimplifySelectInst(llvm::Value*, llvm::Value*, llvm::Value*, (anonymous namespace)::Query const&, unsigned int) /scratch/1/ismail/llvm-upstream/lib/Analysis/InstructionSimplify.cpp:3515:0
#12 0x0000000001f87fe3 llvm::SimplifySelectInst(llvm::Value*, llvm::Value*, llvm::Value*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::DominatorTree const*, llvm::AssumptionCache*, llvm::Instruction const*) /scratch/1/ismail/llvm-upstream/lib/Analysis/InstructionSimplify.cpp:3528:0
…snip…
Stack dump:
0. Program arguments: debugbuild/bin/opt -instcombine -licm -simplifycfg -instcombine -loop-rotate -loop-vectorize -instcombine
- Running pass ‘Function Pass Manager’ on module ‘’.
- Running pass ‘Combine redundant instructions’ on function ‘@strsave’
repro.c (275 Bytes)
ATT00001.htm (215 Bytes)
repro.ll (3.45 KB)
ATT00002.htm (233 Bytes)