@@ -136,7 +136,6 @@ void ConstantCoalescing::ProcessFunction(Function* function)
136136 BasicBlock* top_blk = top_chunk->chunkIO ->getParent ();
137137 if (dom_tree.dominates (top_blk, cur_blk))
138138 break ;
139- // ChangePTRtoOWordBased(top_chunk);
140139 indcb_owloads.pop_back ();
141140 delete top_chunk;
142141 }
@@ -166,7 +165,6 @@ void ConstantCoalescing::ProcessFunction(Function* function)
166165 {
167166 BufChunk* top_chunk = indcb_owloads.back ();
168167 indcb_owloads.pop_back ();
169- // ChangePTRtoOWordBased(top_chunk);
170168 delete top_chunk;
171169 }
172170 while (!indcb_gathers.empty ())
@@ -2519,72 +2517,4 @@ void ConstantCoalescing::ReplaceLoadWithSamplerLoad(
25192517 loadToReplace->replaceAllUsesWith (result);
25202518}
25212519
2522-
2523- // / change GEP to oword-based for oword-aligned load in order to avoid SHL
2524- void ConstantCoalescing::ChangePTRtoOWordBased (BufChunk* chunk)
2525- {
2526- IGC_ASSERT (nullptr != chunk);
2527- IGC_ASSERT (nullptr != chunk->chunkIO );
2528- LoadInst* const load = dyn_cast<LoadInst>(chunk->chunkIO );
2529- IGC_ASSERT (nullptr != load);
2530-
2531- // has to be a 3d-load for now.
2532- // Argument pointer coming from OCL may not be oword-aligned
2533- uint addrSpace = load->getPointerAddressSpace ();
2534- if (addrSpace == ADDRESS_SPACE_CONSTANT)
2535- {
2536- return ;
2537- }
2538- // element index must be a SHL-by-4
2539- // chunk-start must be oword-aligned
2540- if (!(chunk->baseIdxV ) || chunk->chunkStart % 4 )
2541- {
2542- return ;
2543- }
2544- Instruction* ishl = dyn_cast<Instruction>(chunk->baseIdxV );
2545- if (!ishl ||
2546- ishl->getOpcode () != Instruction::Shl ||
2547- !isa<ConstantInt>(ishl->getOperand (1 )))
2548- {
2549- return ;
2550- }
2551- unsigned int constant = int_cast<unsigned int >(cast<ConstantInt>(ishl->getOperand (1 ))->getZExtValue ());
2552- if (constant != 4 )
2553- {
2554- return ;
2555- }
2556- Value* owordIndex = ishl->getOperand (0 );
2557- // want the exact pattern
2558- Value* ptrV = load->getPointerOperand ();
2559- if (!(isa<IntToPtrInst>(ptrV) && ptrV->hasOneUse ()))
2560- {
2561- return ;
2562- }
2563- // do different add, owordIndex + chunkStart/4;
2564- if (chunk->chunkStart != 0 )
2565- {
2566- Instruction* pInsert = dyn_cast<Instruction>(cast<IntToPtrInst>(ptrV)->getOperand (0 ));
2567- if (!pInsert)
2568- {
2569- pInsert = cast<IntToPtrInst>(ptrV);
2570- }
2571- irBuilder->SetInsertPoint (pInsert);
2572- owordIndex = irBuilder->CreateAdd (owordIndex, ConstantInt::get (irBuilder->getInt32Ty (), chunk->chunkStart / 4 ));
2573- wiAns->incUpdateDepend (owordIndex, wiAns->whichDepend (load));
2574- }
2575- Type* vty = IGCLLVM::FixedVectorType::get (load->getType ()->getScalarType (), 4 );
2576- Function* l = GenISAIntrinsic::getDeclaration (curFunc->getParent (),
2577- llvm::GenISAIntrinsic::GenISA_OWordPtr,
2578- PointerType::get (vty, addrSpace));
2579- Value* attr[] =
2580- {
2581- owordIndex
2582- };
2583- irBuilder->SetInsertPoint (load);
2584- Instruction* owordPtr = irBuilder->CreateCall (l, attr);
2585- wiAns->incUpdateDepend (owordPtr, wiAns->whichDepend (load));
2586- load->setOperand (0 , owordPtr);
2587- load->setAlignment (getAlign (16 ));
2588- }
2589-
25902520char IGC::ConstantCoalescing::ID = 0 ;
0 commit comments