Skip to content

Commit f717483

Browse files
committed
GlobalISel: Assert on invalid bitcast in MIRBuilder
The other casts validate, so this should too.
1 parent 752e2e2 commit f717483

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,13 @@ MachineInstrBuilder MachineIRBuilder::buildInstr(unsigned Opc,
10131013
SrcOps[0].getLLTTy(*getMRI()), false);
10141014
break;
10151015
}
1016+
case TargetOpcode::G_BITCAST: {
1017+
assert(DstOps.size() == 1 && "Invalid Dst");
1018+
assert(SrcOps.size() == 1 && "Invalid Srcs");
1019+
assert(DstOps[0].getLLTTy(*getMRI()).getSizeInBits() ==
1020+
SrcOps[0].getLLTTy(*getMRI()).getSizeInBits() && "invalid bitcast");
1021+
break;
1022+
}
10161023
case TargetOpcode::COPY:
10171024
assert(DstOps.size() == 1 && "Invalid Dst");
10181025
// If the caller wants to add a subreg source it has to be done separately

0 commit comments

Comments
 (0)