Allow to disable unsigned operations (zext, icmp ugt, ...)
Unsigned operations are often useful to support but the heuristics are
not yet tuned. This options allows to disable them if necessary.
llvm-svn: 288521
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 756cb5d..60911a7 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -109,6 +109,13 @@
cl::Hidden, cl::init(false), cl::ZeroOrMore,
cl::cat(PollyCategory));
+bool polly::PollyAllowUnsignedOperations;
+static cl::opt<bool, true> XPollyAllowUnsignedOperations(
+ "polly-allow-unsigned-operations",
+ cl::desc("Allow unsigned operations such as comparisons or zero-extends."),
+ cl::location(PollyAllowUnsignedOperations), cl::Hidden, cl::ZeroOrMore,
+ cl::init(true), cl::cat(PollyCategory));
+
bool polly::PollyUseRuntimeAliasChecks;
static cl::opt<bool, true> XPollyUseRuntimeAliasChecks(
"polly-use-runtime-alias-checks",
@@ -454,6 +461,11 @@
const SCEV *LHS = SE->getSCEVAtScope(ICmp->getOperand(0), L);
const SCEV *RHS = SE->getSCEVAtScope(ICmp->getOperand(1), L);
+ // If unsigned operations are not allowed try to approximate the region.
+ if (ICmp->isUnsigned() && !PollyAllowUnsignedOperations)
+ return !IsLoopBranch && AllowNonAffineSubRegions &&
+ addOverApproximatedRegion(RI->getRegionFor(&BB), Context);
+
// Check for invalid usage of different pointers in one expression.
if (ICmp->isEquality() && involvesMultiplePtrs(LHS, nullptr, L) &&
involvesMultiplePtrs(RHS, nullptr, L))