| Issue |
242799
|
| Summary |
[GVN] Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"' failed.
|
| Labels |
crash
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/dGsraxv57
```llvm
define void @main() {
%partial = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i64(i64 5, i64 7)
%all_active = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i64(i64 0, i64 4)
%base_eq_n = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i64(i64 7, i64 7)
%base_gt_n = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i64(i64 9, i64 7)
%no_wrap = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i8(i8 -2, i8 -1)
%unsigned_base = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i8(i8 -2, i8 1)
%unsigned_n = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i8(i8 1, i8 -1)
%lanes_exceed_type = call <8 x i1> @llvm.get.active.lane.mask.v8i1.i2(i2 1, i2 -1)
%wide_operands = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i128(i128 18446744073709551615, i128 18446744073709551618)
%wide_n_minus_base = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i128(i128 1, i128 36893488147419103232)
%max_operands = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i64(i64 -3, i64 -1)
; More lanes than 64 and than the operand type can represent.
%many_lanes_partial = call <80 x i1> @llvm.get.active.lane.mask.v80i1.i8(i8 3, i8 72)
%many_lanes_all_active = call <80 x i1> @llvm.get.active.lane.mask.v80i1.i8(i8 0, i8 -1)
%many_lanes_i2 = call <80 x i1> @llvm.get.active.lane.mask.v80i1.i2(i2 0, i2 -1)
%scalable_partial = call <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i64(i64 2, i64 7)
%scalable_all_active = call <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i32(i32 0, i32 100)
%scalable_many_lanes = call <vscale x 40 x i1> @llvm.get.active.lane.mask.nxv40i1.i64(i64 10, i64 80)
%poison_base = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i64(i64 poison, i64 4)
%poison_n = call <4 x i1> @llvm.get.active.lane.mask.v4i1.i64(i64 0, i64 poison)
%scalable_poison_base = call <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i64(i64 poison, i64 4)
ret void
}
```
Backtrace:
```console
opt: /root/llvm-project/llvm/include/llvm/ADT/APInt.h:127: llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"' 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=gvn <source>
1. Running pass "function(gvn<>)" on module "<source>"
2. Running pass "gvn<>" on function "main"
#0 0x00000000008c06e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8c06e8)
#1 0x00000000008bd4d4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x8bd4d4)
#2 0x00000000008bd64e SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fc420e45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x00007fc420e9ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#5 0x00007fc420e4527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#6 0x00007fc420e288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#7 0x00007fc420e2881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#8 0x00007fc420e3b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#9 0x00000000051d8152 (anonymous namespace)::ConstantFoldFixedVectorCall(llvm::StringRef, unsigned int, llvm::FixedVectorType*, llvm::ArrayRef<llvm::Constant*>, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::CallBase const*) ConstantFolding.cpp:0:0
#10 0x00000000051da448 llvm::ConstantFoldCall(llvm::CallBase const*, llvm::Function*, llvm::ArrayRef<llvm::Constant*>, llvm::TargetLibraryInfo const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x51da448)
#11 0x000000000529aef6 tryConstantFoldCall(llvm::CallBase*, llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&) (.isra.0) InstructionSimplify.cpp:0:0
#12 0x00000000052b2dfe llvm::simplifyCall(llvm::CallBase*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x52b2dfe)
#13 0x00000000052b6f6c simplifyInstructionWithOperands(llvm::Instruction*, llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0
#14 0x00000000052b74cb llvm::simplifyInstruction(llvm::Instruction*, llvm::SimplifyQuery const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x52b74cb)
#15 0x0000000004ab2b4b llvm::GVNPassImpl::processInstruction(llvm::Instruction*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4ab2b4b)
#16 0x0000000004ab374d llvm::GVNPassImpl::processBlock(llvm::BasicBlock*) (.part.0) GVN.cpp:0:0
#17 0x0000000004ab41e9 llvm::GVNPassImpl::iterateOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4ab41e9)
#18 0x0000000004ab4826 llvm::GVNPassImpl::run(llvm::Function&, llvm::AssumptionCache&, llvm::DominatorTree&, llvm::TargetLibraryInfo const&, llvm::AAResults&, llvm::MemoryDependenceResults*, llvm::LoopInfo&, llvm::OptimizationRemarkEmitter*, llvm::MemorySSA*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4ab4826)
#19 0x0000000004ab5a1a llvm::GVNPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x4ab5a1a)
#20 0x0000000000fc292e llvm::detail::PassModel<llvm::Function, llvm::GVNPass, llvm::AnalysisManager<llvm::Function>>::runImpl(llvm::detail::PassConcept<llvm::Function, llvm::AnalysisManager<llvm::Function>>&, llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xfc292e)
#21 0x0000000005be9b21 llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5be9b21)
#22 0x0000000000fc250e llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::runImpl(llvm::detail::PassConcept<llvm::Function, llvm::AnalysisManager<llvm::Function>>&, llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0xfc250e)
#23 0x0000000005be80bc llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5be80bc)
#24 0x000000000098680e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::runImpl(llvm::detail::PassConcept<llvm::Module, llvm::AnalysisManager<llvm::Module>>&, llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x98680e)
#25 0x0000000005be78ae llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5be78ae)
#26 0x0000000000990277 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPluginLibraryInfo>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x990277)
#27 0x00000000009859ac optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9859ac)
#28 0x000000000083fbc0 main (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x83fbc0)
#29 0x00007fc420e2a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#30 0x00007fc420e2a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#31 0x000000000089f395 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x89f395)
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs