Bug found in inject virtual thread

I used an IfThenElse stmt, But the Else part was disappeared after inject virtual thread pass. It works after a little modification of IfThenElse Mutate in VTInjector. Does this modification fixed the bug?

@@ -321,7 +321,7 @@ class VTInjector : public IRMutator {
CHECK_EQ(max_loop_depth_, 0);
Stmt then_case = this->Mutate(op->then_case);
Stmt else_case;

  • if (else_case.defined()) {
  • if (op->else_case.defined()) {
    int temp = max_loop_depth_;
    max_loop_depth_ = 0;
    else_case = this->Mutate(op->else_case);

Thanks for spotting this, please submit a PR with the fix, with a test case that guard against this failure.