MasterJH5574 commented on a change in pull request #9958:
URL: https://github.com/apache/tvm/pull/9958#discussion_r786740740
##########
File path: src/tir/transforms/ir_utils.cc
##########
@@ -278,7 +280,12 @@ Map<Var, Range>
ConditionalBoundsContext::GetVarBoundsFromCondition() {
}
});
if (is_simple && !cand_vars.empty()) {
- for (const Var& var : cand_vars) var_set.insert(var);
+ for (const Var& var : cand_vars) {
+ if (!var_set.count(var)) {
+ vars.push_back(var);
+ var_set.insert(var);
+ }
+ }
Review comment:
Personally I recommend using `std::find(vars.begin(), vars.end(), var)
!= vars.end()` instead of using a `var_set` for looking up, because usually we
don't have few variables and the map doesn't bring performance improvement :-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]