Lines Matching defs:PHI

369   if (auto *PHI = dyn_cast<PHINode>(Inst)) {
370 copyPHIInstruction(Stmt, PHI, BBMap, LTS);
804 // For PHI nodes, the only values we need to store are the ones that
805 // reach the PHI node from outside the region. In general there should
808 auto PHI = cast<PHINode>(Array->getBasePtr());
810 for (auto BI = PHI->block_begin(), BE = PHI->block_end(); BI != BE; BI++)
815 int Idx = PHI->getBasicBlockIndex(PreEntryBB);
819 Value *ScalarValue = PHI->getIncomingValue(Idx);
830 // PHI nodes that are not marked as such in their SAI object are either exit
831 // PHI nodes we model as common scalars but without initialization, or
834 if (auto *PHI = dyn_cast_or_null<PHINode>(Inst))
835 if (!S.hasSingleExitEdge() && PHI->getBasicBlockIndex(ExitBB) >= 0)
869 // Create the merge PHI that merges the optimized and unoptimized version.
874 // Add the respective values to the merge PHI.
883 // Replace all uses of the demoted instruction with the merge PHI.
929 // Only Value-like scalars need a merge PHI. Exit block PHIs receive either
930 // the original PHI's value or the reloaded incoming values from the
936 PHINode *PHI = dyn_cast<PHINode>(Val);
937 if (!PHI)
940 if (PHI->getParent() != AfterMergeBB)
943 std::string Name = PHI->getName().str();
947 Reload = Builder.CreateBitOrPointerCast(Reload, PHI->getType());
948 Value *OriginalValue = PHI->getIncomingValueForBlock(MergeBB);
952 auto *MergePHI = PHINode::Create(PHI->getType(), 2, Name + ".ph.merge");
956 int Idx = PHI->getBasicBlockIndex(MergeBB);
957 PHI->setIncomingValue(Idx, MergePHI);
1118 // In order to remap PHI nodes we store also basic block mappings.
1122 // Add values to incomplete PHI nodes waiting for this block to be copied.
1174 // Add counting PHI nodes to all loops in the region that can be used as
1239 // Add the incoming values to the PHI.
1268 "PHI WRITEs must have originate from at least one incoming block");
1270 // If there is only one incoming value, we do not need to create a PHI.
1333 void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, PHINode *PHI,
1336 // If the incoming block was not yet copied mark this PHI as incomplete.
1343 "Bad incoming block for PHI in non-affine region");
1344 IncompletePHINodeMap[IncomingBB].push_back(std::make_pair(PHI, PHICopy));
1349 "Incoming PHI block did not have a BBMap");
1355 Value *Op = PHI->getIncomingValueForBlock(IncomingBB);
1374 OpCopy = getNewValue(Stmt, PHI, BBCopyMap, LTS, getLoopForStmt(Stmt));
1377 assert(OpCopy && "Incoming PHI value was not copied properly");
1381 void RegionGenerator::copyPHIInstruction(ScopStmt &Stmt, PHINode *PHI,
1384 unsigned NumIncoming = PHI->getNumIncomingValues();
1386 Builder.CreatePHI(PHI->getType(), NumIncoming, "polly." + PHI->getName());
1388 BBMap[PHI] = PHICopy;
1390 for (BasicBlock *IncomingBB : PHI->blocks())
1391 addOperandToPHI(Stmt, PHI, PHICopy, IncomingBB, LTS);