Hi, community.
I am working for porting newlib to a new backend, and I meet a problem related with legalizing an extended value type. The LLVM Backend throw an assertion fail:
clang-10: ../include/llvm/CodeGen/ValueTypes.h:256: llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a SimpleValueType!"' failed.
I print the SelectionDAG with -debug-only=isel
, here is what goes wrong:
Optimized lowered selection DAG: %bb.4 'reallocarray:entry'
SelectionDAG has 21 nodes:
t0: ch = EntryToken
t2: i32,ch = CopyFromReg t0, Register:i32 %5
t8: i32,ch = CopyFromReg t0, Register:i32 %7
t4: i32,ch = CopyFromReg t2:1, Register:i32 %6
t5: i64 = build_pair t2, t4
t6: i33 = truncate t5
t10: i32,ch = CopyFromReg t8:1, Register:i32 %8
t12: i32 = AssertSext t10, ValueType:ch:i1
t13: i64 = build_pair t8, t12
t14: i33 = truncate t13
t24: i1 = setcc t6, t14, seteq:ch, ../../../../../newlib-cygwin/newlib/libc/stdlib/reallocarray.c:29:6
t25: ch = brcond t0, t24, BasicBlock:ch<if.end 0x7fffd4e54988>, ../../../../../newlib-cygwin/newlib/libc/stdlib/reallocarray.c:29:6
t22: ch = br t25, BasicBlock:ch<if.then 0x7fffd4e548c8>, ../../../../../newlib-cygwin/newlib/libc/stdlib/reallocarray.c:29:6
I found SelectionDAG create a i33 valuetype node at t6 and t14, which lead to a problem when compiler try to legalize setCC node. The setCC require a SimpleTypeValue. Is there any solution I can fix this error?