@@ -197,9 +197,9 @@ bool SPIRVInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
197
197
} else if (MI->getOpcode () == SPIRV::OpBranchConditional) {
198
198
Cond.push_back (MI->getOperand (0 ));
199
199
TBB = MI->getOperand (1 ).getMBB ();
200
- FBB = MI->getOperand ( 2 ). getMBB ();
201
- for ( unsigned I = 3 , E = MI->getNumOperands (); I < E; ++I)
202
- Cond. push_back (MI-> getOperand (I));
200
+ if ( MI->getNumOperands () == 3 ) {
201
+ FBB = MI->getOperand ( 2 ). getMBB ();
202
+ }
203
203
return false ;
204
204
} else {
205
205
return true ;
@@ -212,17 +212,9 @@ bool SPIRVInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
212
212
// If \p BytesRemoved is non-null, report the change in code size from the
213
213
// removed instructions.
214
214
unsigned SPIRVInstrInfo::removeBranch (MachineBasicBlock &MBB,
215
- int * /* BytesRemoved*/ ) const {
216
- MachineBasicBlock::iterator I = MBB.getLastNonDebugInstr ();
217
- if (I == MBB.end ())
218
- return 0 ;
219
-
220
- unsigned Opcode = I->getOpcode ();
221
- if (Opcode == SPIRV::OpBranch || Opcode == SPIRV::OpBranchConditional) {
222
- I->eraseFromParent ();
223
- return 1 ;
224
- }
225
- return 0 ;
215
+ int *BytesRemoved) const {
216
+ report_fatal_error (" Branch removal not supported, as MBB info not propagated"
217
+ " to OpPhi instructions. Try using -O0 instead." );
226
218
}
227
219
228
220
// Insert branch code into the end of the specified MachineBasicBlock. The
@@ -238,25 +230,12 @@ unsigned SPIRVInstrInfo::removeBranch(MachineBasicBlock &MBB,
238
230
//
239
231
// The CFG information in MBB.Predecessors and MBB.Successors must be valid
240
232
// before calling this function.
241
- unsigned SPIRVInstrInfo::insertBranch (MachineBasicBlock &MBB,
242
- MachineBasicBlock *TBB,
243
- MachineBasicBlock *FBB,
244
- ArrayRef<MachineOperand> Cond,
245
- const DebugLoc &DL,
246
- int * /* BytesAdded*/ ) const {
247
- if (!TBB)
248
- return 0 ;
249
- if (Cond.empty ()) {
250
- BuildMI (&MBB, DL, get (SPIRV::OpBranch)).addMBB (TBB);
251
- } else {
252
- auto MIB = BuildMI (&MBB, DL, get (SPIRV::OpBranchConditional))
253
- .add (Cond[0 ])
254
- .addMBB (TBB)
255
- .addMBB (FBB);
256
- for (unsigned i = 1 ; i < Cond.size (); ++i)
257
- MIB.add (Cond[i]);
258
- }
259
- return 1 ;
233
+ unsigned SPIRVInstrInfo::insertBranch (
234
+ MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB,
235
+ ArrayRef<MachineOperand> Cond, const DebugLoc &DL, int *BytesAdded) const {
236
+ report_fatal_error (" Branch insertion not supported, as MBB info not "
237
+ " propagated to OpPhi instructions. Try using "
238
+ " -O0 instead." );
260
239
}
261
240
262
241
void SPIRVInstrInfo::copyPhysReg (MachineBasicBlock &MBB,
0 commit comments