@@ -201,7 +201,7 @@ static Instruction *getInsertionPtForSplitOp(Use &Op, Instruction &Inst) {
201
201
auto &OpVal = *Op.get ();
202
202
if (isa<Instruction>(OpVal))
203
203
return getFirstInsertionPtAfter (cast<Instruction>(OpVal));
204
- IGC_ASSERT (isa<Constant>(OpVal) && " only instruction or constant are expected" );
204
+ IGC_ASSERT_MESSAGE (isa<Constant>(OpVal), " only instruction or constant are expected" );
205
205
return getFirstInsertionPtBefore (Op, Inst);
206
206
}
207
207
@@ -218,14 +218,14 @@ static Instruction *getInsertionPtForSplitOp(Use &Op, Instruction &Inst) {
218
218
static std::vector<Instruction *> createSplitOperand (Use &Op,
219
219
Instruction &Inst) {
220
220
auto &OpVal = *Op.get ();
221
- IGC_ASSERT (OpVal.getType ()->isAggregateType () && " wrong argument" );
221
+ IGC_ASSERT_MESSAGE (OpVal.getType ()->isAggregateType (), " wrong argument" );
222
222
// TODO: support ArrayType
223
223
auto *InstTy = cast<StructType>(OpVal.getType ());
224
224
auto *InsertionPt = getInsertionPtForSplitOp (Op, Inst);
225
225
std::vector<Instruction *> SplitOperand;
226
226
for (unsigned i = 0 ; i < InstTy->getNumElements (); ++i) {
227
- IGC_ASSERT (!InstTy->getElementType (i)->isAggregateType () &&
228
- " folded structures is yet unsupported" );
227
+ IGC_ASSERT_MESSAGE (!InstTy->getElementType (i)->isAggregateType (),
228
+ " folded structures is yet unsupported" );
229
229
SplitOperand.push_back (
230
230
ExtractValueInst::Create (&OpVal, i, " " , InsertionPt));
231
231
}
@@ -238,8 +238,8 @@ static std::vector<Instruction *> createSplitOperand(Use &Op,
238
238
// Splits all aggregate operands of provided \p Inst.
239
239
// Returns a map between original operands and created instructions.
240
240
static SplitOpsMap createSplitOperands (Instruction &Inst) {
241
- IGC_ASSERT (hasAggregateOperand (Inst) &&
242
- " wrong argument: inst must have aggregate operand" );
241
+ IGC_ASSERT_MESSAGE (hasAggregateOperand (Inst),
242
+ " wrong argument: inst must have aggregate operand" );
243
243
auto AggregateOps = make_filter_range (Inst.operands (), [](const Use &U) {
244
244
return U->getType ()->isAggregateType ();
245
245
});
@@ -284,25 +284,24 @@ std::vector<Value *> createSplitInstOperands(int elemIdx, OpRange OrigOps,
284
284
static Instruction *createSplitInst (Instruction &Inst,
285
285
const std::vector<Value *> &NewOps) {
286
286
if (isa<SelectInst>(Inst)) {
287
- IGC_ASSERT (NewOps.size () == 3 && " select must have 3 operands" );
287
+ IGC_ASSERT_MESSAGE (NewOps.size () == 3 , " select must have 3 operands" );
288
288
auto *NewSelect =
289
289
SelectInst::Create (NewOps[0 ], NewOps[1 ], NewOps[2 ],
290
290
Inst.getName () + " .split.aggr" , &Inst, &Inst);
291
291
NewSelect->setDebugLoc (Inst.getDebugLoc ());
292
292
return NewSelect;
293
293
}
294
- IGC_ASSERT (isa<PHINode>(Inst) && " unsupported instruction" );
295
- IGC_ASSERT (Inst.getNumOperands () == NewOps.size () && " " );
294
+ IGC_ASSERT_MESSAGE (isa<PHINode>(Inst), " unsupported instruction" );
295
+ IGC_ASSERT (Inst.getNumOperands () == NewOps.size ());
296
296
auto *NewPHI = PHINode::Create (NewOps[0 ]->getType (), NewOps.size (),
297
297
Inst.getName () + " .split.aggr" , &Inst);
298
298
299
299
auto &OldPHI = cast<PHINode>(Inst);
300
300
for (auto &&Incoming : zip (NewOps, OldPHI.blocks ())) {
301
301
Value *OpVal = std::get<0 >(Incoming);
302
302
BasicBlock *OpBB = std::get<1 >(Incoming);
303
- IGC_ASSERT (isa<ExtractValueInst>(OpVal) &&
304
- " phi operands must be previously in this pass created "
305
- " extractvalue insts" );
303
+ IGC_ASSERT_MESSAGE (isa<ExtractValueInst>(OpVal),
304
+ " phi operands must be previously in this pass created extractvalue insts" );
306
305
auto *OpInst = cast<Instruction>(OpVal);
307
306
NewPHI->addIncoming (OpInst, OpBB);
308
307
}
@@ -341,8 +340,8 @@ createSplitInsts(Instruction &Inst, const SplitOpsMap &SplitOps) {
341
340
// Last insertvalue instruction that form full aggregate value is returned.
342
341
static Instruction *joinSplitInsts (const std::vector<Instruction *> &SplitInsts,
343
342
Type *JoinTy, Instruction *InsertBefore) {
344
- IGC_ASSERT (SplitInsts.size () == cast<StructType>(JoinTy)->getNumElements () &&
345
- " number of splitted insts doesn't correspond with aggregate type" );
343
+ IGC_ASSERT_MESSAGE (SplitInsts.size () == cast<StructType>(JoinTy)->getNumElements (),
344
+ " number of splitted insts doesn't correspond with aggregate type" );
346
345
Value *JoinInst = UndefValue::get (JoinTy);
347
346
unsigned Idx = 0 ;
348
347
for (auto *SplitInst : SplitInsts) {
@@ -353,8 +352,8 @@ static Instruction *joinSplitInsts(const std::vector<Instruction *> &SplitInsts,
353
352
}
354
353
355
354
void GenXAggregatePseudoLowering::processInst (Instruction &Inst) {
356
- IGC_ASSERT (hasAggregate (Inst) &&
357
- " wrong argument: instruction doesn't work with aggregates" );
355
+ IGC_ASSERT_MESSAGE (hasAggregate (Inst),
356
+ " wrong argument: instruction doesn't work with aggregates" );
358
357
SplitOpsMap NewOperands;
359
358
if (hasAggregateOperand (Inst))
360
359
NewOperands = createSplitOperands (Inst);
0 commit comments