This patch is created to fix the Bugzilla bug 39815.
This patch is to support promotion integer result for the instruction ADDE, SUBE.
Before this fix, for below test case:
@b = common local_unnamed_addr global i64* null, align 8 @a = common local_unnamed_addr global i8 0, align 1 define void @testADDEPromoteResult() { entry: %0 = load i64*, i64** @b, align 8 %1 = load i64, i64* %0, align 8 %cmp = icmp ne i64* %0, null %conv1 = zext i1 %cmp to i64 %add = add nsw i64 %1, %conv1 %2 = trunc i64 %add to i8 %conv2 = and i8 %2, 5 store i8 %conv2, i8* @a, align 1 ret void }
We use llc test.ll to build the case, then we will get below error:
PromoteIntegerResult #0: t28: i8,i64 = adde t29, Constant:i8<0>, t24:1 Do not know how to promote this operator! UNREACHABLE executed at /home/ken/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:55! Stack dump: 0. Program arguments: llc sim.ll 1. Running pass 'Function Pass Manager' on module 'sim.ll'. 2. Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@testPromoteOperand'