llvm-external-projects/iree-dialects/lib/Dialect/IREEPyDM/IR/Ops.cpp
/// Given the region at `index`, or the parent operation if `index` is None,
/// return the successor regions. These are the regions that may be selected
/// during the flow of control. `operands` is a set of optional attributes that
/// correspond to a constant value for each operand, or null if that operand is
/// not a constant.
Given the region at `index`, or the parent operation if `index` is None,
return the successor regions. These are the regions that may be selected
during the flow of control. `operands` is a set of optional attributes that
correspond to a constant value for each operand, or null if that operand is
not a constant.
Given the region at ` index ` or the parent operation if ` index ` is None return the successor regions . These are the regions that may be selected during the flow of control . ` operands ` is a set of optional attributes that correspond to a constant value for each operand or null if that operand is not a constant .
void FunctionalIfOp::getSuccessorRegions(
    Optional<unsigned> index, ArrayRef<Attribute> operands,
    SmallVectorImpl<RegionSuccessor> &regions) {
  if (index.hasValue()) {
    regions.push_back(RegionSuccessor(getResults()));
    return;
  }
  Region *elseRegion = &this->elseRegion();
  if (elseRegion->empty()) elseRegion = nullptr;
  if (auto condAttr = operands.front().dyn_cast_or_null<BoolAttr>()) {
    bool condition = condAttr.getValue();
    regions.push_back(RegionSuccessor(condition ? &thenRegion() : elseRegion));
  } else {
    regions.push_back(RegionSuccessor(&thenRegion()));
    if (elseRegion) regions.push_back(RegionSuccessor(elseRegion));
  }
}
void FunctionalIfOp :: getSuccessorRegions ( Optional < unsigned > index , ArrayRef < Attribute > operands , SmallVectorImpl < RegionSuccessor > & regions ) { if ( index . hasValue ( ) ) { regions . push_back ( RegionSuccessor ( getResults ( ) ) ) ; return ; } Region * elseRegion = & this -> elseRegion ( ) ; if ( elseRegion -> empty ( ) ) elseRegion = nullptr ; if ( auto condAttr = operands . front ( ) . dyn_cast_or_null < BoolAttr > ( ) ) { bool condition = condAttr . getValue ( ) ; regions . push_back ( RegionSuccessor ( condition ? & thenRegion ( ) : elseRegion ) ) ; } else { regions . push_back ( RegionSuccessor ( & thenRegion ( ) ) ) ; if ( elseRegion ) regions . push_back ( RegionSuccessor ( elseRegion ) ) ; } }
Given the region at `index`, or the parent operation if `index` is None,
return the successor regions.
Given the region at ` index ` or the parent operation if ` index ` is None return the successor regions .
// The `then` and the `else` region branch back to the parent operation. // Don't consider the else region if it is empty. // Otherwise, the successor is dependent on the condition. // Add the successor regions using the condition. // If the condition isn't constant, both regions may be executed. // If the else region does not exist, it is not a viable successor.