Do not assume all multi-parameter products are affine
As soon as one operand of the product is invalid, the entire product is invalid.
This happens for example if one of the operands is not loop-invariant.
This fixes http://llvm.org/PR23125
Reported-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com
llvm-svn: 234119
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp
index 048fdc3..1cfbd66 100644
--- a/polly/lib/Support/SCEVValidator.cpp
+++ b/polly/lib/Support/SCEVValidator.cpp
@@ -228,7 +228,7 @@
Return.merge(Op);
}
- if (HasMultipleParams)
+ if (HasMultipleParams && Return.isValid())
return ValidatorResult(SCEVType::PARAM, Expr);
// TODO: Check for NSW and NUW.