"...gpu/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "dbd34685c0d09f96468c0bb2bb0b5436489c7650"
assume.cc 658 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

/*!
 * \file assume.cc
 * \brief Utils on assume statements
 */

#include "assume.h"
#include "tvm/tir/builtin.h"
#include "tvm/tir/expr.h"

namespace tvm {
namespace tl {

using namespace tir;

std::optional<PrimExpr> GetAssumeExprInEvaluateForm(Stmt stmt) {
  auto eval = stmt.as<EvaluateNode>();
  if (!eval)
    return std::nullopt;
  auto call = eval->value.as<CallNode>();
  if (!call)
    return std::nullopt;
  if (!call->op.same_as(builtin::assume()))
    return std::nullopt;
  return call->args[0];
}

bool IsAssumeInEvaluateForm(const Stmt &stmt) {
  return GetAssumeExprInEvaluateForm(stmt).has_value();
}

} // namespace tl
} // namespace tvm