@@ -172,7 +172,6 @@ bool genx::loadNonSimpleConstants(
172
172
continue ;
173
173
ConstantLoader CL (C, Subtarget, DL, Inst, AddedInstructions);
174
174
if (CL.needFixingSimple ()) {
175
- Modified = true ;
176
175
CL.fixSimple (i);
177
176
continue ;
178
177
}
@@ -774,7 +773,7 @@ bool genx::loadPhiConstants(Function &F, DominatorTree *DT,
774
773
Value *Load = nullptr ;
775
774
Instruction *InsertBefore = InsertBB->getTerminator ();
776
775
if (!CL.isSimple ())
777
- Load = CL.loadBig (InsertBefore);
776
+ Load = CL.loadNonSimple (InsertBefore);
778
777
else
779
778
Load = CL.load (InsertBefore);
780
779
Modified = true ;
@@ -853,7 +852,6 @@ bool genx::isReplicatedConstantVector(
853
852
}
854
853
855
854
void ConstantLoader::fixSimple (int OperandIdx) {
856
- IGC_ASSERT_MESSAGE (User, " user must be provided" );
857
855
IGC_ASSERT_MESSAGE (NewC, " no need to fix simple case" );
858
856
IGC_ASSERT_MESSAGE (User->getOperand (OperandIdx) == C,
859
857
" wrong arguments: wrong operand index was provided" );
@@ -872,7 +870,8 @@ void ConstantLoader::fixSimple(int OperandIdx) {
872
870
*
873
871
* Return: new instruction
874
872
*/
875
- Instruction *ConstantLoader::loadNonSimple (Instruction *Inst) {
873
+ Instruction *ConstantLoader::loadNonSimple (Instruction *Inst)
874
+ {
876
875
IGC_ASSERT (!isSimple ());
877
876
if (!isLegalSize ())
878
877
return loadBig (Inst);
@@ -1336,7 +1335,8 @@ Instruction *ConstantLoader::loadNonPackedIntConst(Instruction *InsertBefore) {
1336
1335
* ConstantLoader::loadBig : insert instruction to load a constant that might
1337
1336
* be illegally sized
1338
1337
*/
1339
- Instruction *ConstantLoader::loadBig (Instruction *InsertBefore) {
1338
+ Instruction *ConstantLoader::loadBig (Instruction *InsertBefore)
1339
+ {
1340
1340
if (isLegalSize () || isa<UndefValue>(C)) {
1341
1341
// Does not need legalizing.
1342
1342
if (!isSimple ())
@@ -1388,11 +1388,12 @@ Instruction *ConstantLoader::loadBig(Instruction *InsertBefore) {
1388
1388
/* **********************************************************************
1389
1389
* ConstantLoader::isLegalSize : detect if a constant is a legal size
1390
1390
*/
1391
- bool ConstantLoader::isLegalSize () const {
1391
+ bool ConstantLoader::isLegalSize ()
1392
+ {
1392
1393
auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(C->getType ());
1393
1394
if (!VT)
1394
1395
return true ;
1395
- const int NumBits = DL.getTypeSizeInBits (VT );
1396
+ const int NumBits = DL.getTypeSizeInBits (C-> getType () );
1396
1397
if (!llvm::isPowerOf2_32 (NumBits))
1397
1398
return false ;
1398
1399
const int GRFSizeInBits = Subtarget.getGRFByteSize () * genx::ByteBits;
@@ -1410,7 +1411,7 @@ bool ConstantLoader::isLegalSize() const {
1410
1411
* This does not do a thorough check so it misses some cases of a constant
1411
1412
* that would split into simple constants.
1412
1413
*/
1413
- bool ConstantLoader::isBigSimple () const
1414
+ bool ConstantLoader::isBigSimple ()
1414
1415
{
1415
1416
IGC_ASSERT_MESSAGE (!needFixingSimple (),
1416
1417
" simple case shall be fixed first before this call" );
@@ -1431,7 +1432,7 @@ bool ConstantLoader::isBigSimple() const
1431
1432
*
1432
1433
* A simple constant is one we know can be a constant operand in an instruction.
1433
1434
*/
1434
- bool ConstantLoader::isSimple () const
1435
+ bool ConstantLoader::isSimple ()
1435
1436
{
1436
1437
IGC_ASSERT_MESSAGE (!needFixingSimple (),
1437
1438
" simple case shall be fixed first before this call" );
@@ -1464,7 +1465,8 @@ bool ConstantLoader::allowI64Ops() const {
1464
1465
* ConstantLoader::isPackedIntVector : check for a packed int vector
1465
1466
* (having already done the analysis in the ConstantLoader constructor)
1466
1467
*/
1467
- bool ConstantLoader::isPackedIntVector () const {
1468
+ bool ConstantLoader::isPackedIntVector ()
1469
+ {
1468
1470
// Check for a packed int vector. Either the element type must be i16, or
1469
1471
// the user (instruction using the constant) must be genx.constanti or
1470
1472
// wrregion or wrconstregion. Not allowed if the user is a logic op.
@@ -1496,7 +1498,7 @@ bool ConstantLoader::isPackedIntVector() const {
1496
1498
* ConstantLoader::isPackedFloatVector : check for a packed float vector
1497
1499
* (having already done the analysis in the ConstantLoader constructor)
1498
1500
*/
1499
- bool ConstantLoader::isPackedFloatVector () const {
1501
+ bool ConstantLoader::isPackedFloatVector () {
1500
1502
auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(C->getType ());
1501
1503
if (!VT)
1502
1504
return false ;
@@ -1512,7 +1514,8 @@ bool ConstantLoader::isPackedFloatVector() const {
1512
1514
* A "consolidated constant" is one where a vector of byte or short is
1513
1515
* turned into the equivalent (as if by bitcast) vector of int.
1514
1516
*/
1515
- Constant *ConstantLoader::getConsolidatedConstant (Constant *C) {
1517
+ Constant *ConstantLoader::getConsolidatedConstant (Constant *C)
1518
+ {
1516
1519
if (isa<UndefValue>(C))
1517
1520
return nullptr ;
1518
1521
auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(C->getType ());
@@ -1570,7 +1573,8 @@ Constant *ConstantLoader::getConsolidatedConstant(Constant *C) {
1570
1573
* (integer 8 or fp 4) can be loaded as a packed vector, possibly scaled
1571
1574
* and adjusted.
1572
1575
*/
1573
- void ConstantLoader::analyze () {
1576
+ void ConstantLoader::analyze ()
1577
+ {
1574
1578
auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(C->getType ());
1575
1579
if (!VT)
1576
1580
return ;
@@ -1589,7 +1593,8 @@ void ConstantLoader::analyze() {
1589
1593
analyzeForPackedFloat (NumElements);
1590
1594
}
1591
1595
1592
- void ConstantLoader::analyzeForPackedInt (unsigned NumElements) {
1596
+ void ConstantLoader::analyzeForPackedInt (unsigned NumElements)
1597
+ {
1593
1598
// Get element values.
1594
1599
int64_t Min = INT64_MAX;
1595
1600
int64_t Max = INT64_MIN;
0 commit comments