[PATCH] D142292: [SCEV] Introduce `SCEVSelectExpr`

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 22 16:27:48 PST 2023


efriedma added a comment.

My primary concern here is compile-time; in general, the more complex expressions we model, the more we have to worry about SCEV going out of control in complex cases.



================
Comment at: polly/lib/Support/SCEVValidator.cpp:352
+  ValidatorResult visitSelectExpr(const SCEVSelectExpr *Expr) {
+    // FIXME: what do we want to happen here?
+    return ValidatorResult(SCEVType::INVALID);
----------------
Something like the following should fix the regression on polly/test/ScopInfo/Alias-0.ll etc.:

```
    ValidatorResult Cond = visit(Expr->getCondition());
    ValidatorResult TrueExpr = visit(Expr->getTrueValue());
    ValidatorResult FalseExpr = visit(Expr->getFalseValue());
    if (Cond.isConstant() && TrueExpr.isConstant() && FalseExpr.isConstant())
      return ValidatorResult(SCEVType::PARAM, Expr);
    LLVM_DEBUG(dbgs() << "INVALID: select of non-constant expressions");
    return ValidatorResult(SCEVType::INVALID);
```

(The tests involving undef selects probably need to be modified to avoid using undef.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142292/new/

https://reviews.llvm.org/D142292



More information about the llvm-commits mailing list