Home | History | Annotate | Download | only in opt

Lines Matching refs:SENode

81                      SENode* node_to_simplify)
87 SENode* Simplify();
95 void GatherAccumulatorsFromChildNodes(SENode* new_node, SENode* child,
103 bool AccumulatorsFromMultiply(SENode* multiply, bool negation);
111 SENode* SimplifyRecurrentAddExpression(SERecurrentNode* node);
116 SENode* SimplifyPolynomial();
129 SENode* FoldRecurrentAddExpressions(SENode*);
135 SENode* EliminateZeroCoefficientRecurrents(SENode* node);
141 SENode* node_;
148 std::map<SENode*, int64_t> accumulators_;
152 bool SENodeSimplifyImpl::AccumulatorsFromMultiply(SENode* multiply,
155 multiply->GetType() != SENode::Multiply)
158 SENode* operand_1 = multiply->GetChild(0);
159 SENode* operand_2 = multiply->GetChild(1);
161 SENode* value_unknown = nullptr;
162 SENode* constant = nullptr;
165 if (operand_1->GetType() == SENode::ValueUnknown ||
166 operand_1->GetType() == SENode::RecurrentAddExpr)
168 else if (operand_2->GetType() == SENode::ValueUnknown ||
169 operand_2->GetType() == SENode::RecurrentAddExpr)
173 if (operand_1->GetType() == SENode::Constant)
175 else if (operand_2->GetType() == SENode::Constant)
198 SENode* SENodeSimplifyImpl::Simplify() {
201 if (node_->GetType() != SENode::Add && node_->GetType() != SENode::Multiply &&
202 node_->GetType() != SENode::Negative)
205 SENode* simplified_polynomial = SimplifyPolynomial();
219 for (SENode* child : simplified_polynomial->GetChildren()) {
220 if (child->GetType() == SENode::RecurrentAddExpr) {
229 if (child_iterator->GetType() == SENode::RecurrentAddExpr &&
243 void SENodeSimplifyImpl::GatherAccumulatorsFromChildNodes(SENode* new_node,
244 SENode* child,
248 if (child->GetType() == SENode::Constant) {
253 } else if (child->GetType() == SENode::ValueUnknown ||
254 child->GetType() == SENode::RecurrentAddExpr) {
267 } else if (child->GetType() == SENode::Multiply) {
272 } else if (child->GetType() == SENode::Add) {
273 for (SENode* next_child : *child) {
277 } else if (child->GetType() == SENode::Negative) {
278 SENode* negated_node = child->GetChild(0);
292 SENode* new_coefficient = analysis_.CreateMultiplyNode(
297 SENode* simplified = analysis_.SimplifyExpression(new_coefficient);
298 if (simplified->GetType() != SENode::CanNotCompute)
315 SENode* SENodeSimplifyImpl::SimplifyPolynomial() {
316 std::unique_ptr<SENode> new_add{new SEAddNode(node_->GetParentAnalysis())};
327 SENode* term = pair.first;
335 } else if (count == -1 && term->GetType() != SENode::RecurrentAddExpr) {
345 if (term->GetType() == SENode::ValueUnknown) {
346 SENode* count_as_constant = analysis_.CreateConstant(count);
350 assert(term->GetType() == SENode::RecurrentAddExpr &&
373 SENode* SENodeSimplifyImpl::FoldRecurrentAddExpressions(SENode* root) {
383 for (SENode* child : *root) {
386 if (child->GetType() == SENode::Negative) {
391 if (child->GetType() == SENode::RecurrentAddExpr) {
413 std::unique_ptr<SENode> new_coefficient{new SEAddNode(&analysis_)};
414 std::unique_ptr<SENode> new_offset{new SEAddNode(&analysis_)};
433 SENode* new_coefficient_simplified =
436 SENode* new_offset_simplified =
439 if (new_coefficient_simplified->GetType() == SENode::Constant &&
459 SENode* SENodeSimplifyImpl::EliminateZeroCoefficientRecurrents(SENode* node) {
460 if (node->GetType() != SENode::Add) return node;
464 std::vector<SENode*> new_children{};
465 for (SENode* child : *node) {
466 if (child->GetType() == SENode::RecurrentAddExpr) {
467 SENode* coefficient = child->AsSERecurrentNode()->GetCoefficient();
471 if (coefficient->GetType() == SENode::Constant &&
485 std::unique_ptr<SENode> new_add{new SEAddNode(node_->GetParentAnalysis())};
487 for (SENode* child : new_children) {
494 SENode* SENodeSimplifyImpl::SimplifyRecurrentAddExpression(
496 const std::vector<SENode*>& children = node_->GetChildren();
502 std::unique_ptr<SENode> new_offset{
506 for (SENode* child : children) {
507 if (child->GetType() != SENode::RecurrentAddExpr) {
513 SENode* simplified_child = analysis_.SimplifyExpression(new_offset.get());
517 if (simplified_child->GetType() != SENode::CanNotCompute) {
532 SENode* ScalarEvolutionAnalysis::SimplifyExpression(SENode* node) {