@@ -201,7 +201,7 @@ static Instruction *getInsertionPtForSplitOp(Use &Op, Instruction &Inst) {
201201 auto &OpVal = *Op.get ();
202202 if (isa<Instruction>(OpVal))
203203 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" );
205205 return getFirstInsertionPtBefore (Op, Inst);
206206}
207207
@@ -218,14 +218,14 @@ static Instruction *getInsertionPtForSplitOp(Use &Op, Instruction &Inst) {
218218static std::vector<Instruction *> createSplitOperand (Use &Op,
219219 Instruction &Inst) {
220220 auto &OpVal = *Op.get ();
221- IGC_ASSERT (OpVal.getType ()->isAggregateType () && " wrong argument" );
221+ IGC_ASSERT_MESSAGE (OpVal.getType ()->isAggregateType (), " wrong argument" );
222222 // TODO: support ArrayType
223223 auto *InstTy = cast<StructType>(OpVal.getType ());
224224 auto *InsertionPt = getInsertionPtForSplitOp (Op, Inst);
225225 std::vector<Instruction *> SplitOperand;
226226 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" );
229229 SplitOperand.push_back (
230230 ExtractValueInst::Create (&OpVal, i, " " , InsertionPt));
231231 }
@@ -238,8 +238,8 @@ static std::vector<Instruction *> createSplitOperand(Use &Op,
238238// Splits all aggregate operands of provided \p Inst.
239239// Returns a map between original operands and created instructions.
240240static 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" );
243243 auto AggregateOps = make_filter_range (Inst.operands (), [](const Use &U) {
244244 return U->getType ()->isAggregateType ();
245245 });
@@ -284,25 +284,24 @@ std::vector<Value *> createSplitInstOperands(int elemIdx, OpRange OrigOps,
284284static Instruction *createSplitInst (Instruction &Inst,
285285 const std::vector<Value *> &NewOps) {
286286 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" );
288288 auto *NewSelect =
289289 SelectInst::Create (NewOps[0 ], NewOps[1 ], NewOps[2 ],
290290 Inst.getName () + " .split.aggr" , &Inst, &Inst);
291291 NewSelect->setDebugLoc (Inst.getDebugLoc ());
292292 return NewSelect;
293293 }
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 ());
296296 auto *NewPHI = PHINode::Create (NewOps[0 ]->getType (), NewOps.size (),
297297 Inst.getName () + " .split.aggr" , &Inst);
298298
299299 auto &OldPHI = cast<PHINode>(Inst);
300300 for (auto &&Incoming : zip (NewOps, OldPHI.blocks ())) {
301301 Value *OpVal = std::get<0 >(Incoming);
302302 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" );
306305 auto *OpInst = cast<Instruction>(OpVal);
307306 NewPHI->addIncoming (OpInst, OpBB);
308307 }
@@ -341,8 +340,8 @@ createSplitInsts(Instruction &Inst, const SplitOpsMap &SplitOps) {
341340// Last insertvalue instruction that form full aggregate value is returned.
342341static Instruction *joinSplitInsts (const std::vector<Instruction *> &SplitInsts,
343342 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" );
346345 Value *JoinInst = UndefValue::get (JoinTy);
347346 unsigned Idx = 0 ;
348347 for (auto *SplitInst : SplitInsts) {
@@ -353,8 +352,8 @@ static Instruction *joinSplitInsts(const std::vector<Instruction *> &SplitInsts,
353352}
354353
355354void 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" );
358357 SplitOpsMap NewOperands;
359358 if (hasAggregateOperand (Inst))
360359 NewOperands = createSplitOperands (Inst);
0 commit comments