diff options
Diffstat (limited to 'polly/lib')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 12 | ||||
| -rw-r--r-- | polly/lib/Analysis/ScopDetectionDiagnostic.cpp | 16 | ||||
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 12 |
3 files changed, 12 insertions, 28 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 2e1caf51b10..4ee92fcfa93 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -149,11 +149,6 @@ static cl::opt<bool> cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory)); -static cl::opt<bool> AllowUnsigned("polly-allow-unsigned", - cl::desc("Allow unsigned expressions"), - cl::Hidden, cl::init(false), cl::ZeroOrMore, - cl::cat(PollyCategory)); - static cl::opt<bool, true> TrackFailures("polly-detect-track-failures", cl::desc("Track failure strings in detecting scop regions"), @@ -385,13 +380,6 @@ bool ScopDetection::isValidBranch(BasicBlock &BB, BranchInst *BI, } ICmpInst *ICmp = cast<ICmpInst>(Condition); - // Unsigned comparisons are not allowed. They trigger overflow problems - // in the code generation. - // - // TODO: This is not sufficient and just hides bugs. However it does pretty - // well. - if (ICmp->isUnsigned() && !AllowUnsigned) - return invalid<ReportUnsignedCond>(Context, /*Assert=*/true, BI, &BB); // Are both operands of the ICmp affine? if (isa<UndefValue>(ICmp->getOperand(0)) || diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp index 5d5a1a43f8e..25b121bc3ae 100644 --- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp +++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp @@ -196,22 +196,6 @@ bool ReportInvalidCond::classof(const RejectReason *RR) { } //===----------------------------------------------------------------------===// -// ReportUnsignedCond. - -std::string ReportUnsignedCond::getMessage() const { - return ("Condition in BB '" + BB->getName()).str() + - "' performs a comparision on (not yet supported) unsigned integers."; -} - -std::string ReportUnsignedCond::getEndUserMessage() const { - return "Unsupported comparision on unsigned integers encountered"; -} - -bool ReportUnsignedCond::classof(const RejectReason *RR) { - return RR->getKind() == rrkUnsignedCond; -} - -//===----------------------------------------------------------------------===// // ReportUndefOperand. std::string ReportUndefOperand::getMessage() const { diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 3b8770afa9a..014919634ed 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -1317,6 +1317,18 @@ buildConditionSets(ScopStmt &Stmt, Value *Condition, TerminatorInst *TI, isl_pw_aff *LHS, *RHS; LHS = Stmt.getPwAff(SE.getSCEVAtScope(ICond->getOperand(0), L)); RHS = Stmt.getPwAff(SE.getSCEVAtScope(ICond->getOperand(1), L)); + + if (ICond->isUnsigned()) { + // For unsigned comparisons we assumed the signed bit of neither operand + // to be set. The comparison is equal to a signed comparison under this + // assumption. + auto *BB = Stmt.getEntryBlock(); + S.recordAssumption(UNSIGNED, isl_pw_aff_nonneg_set(isl_pw_aff_copy(LHS)), + TI->getDebugLoc(), AS_ASSUMPTION, BB); + S.recordAssumption(UNSIGNED, isl_pw_aff_nonneg_set(isl_pw_aff_copy(RHS)), + TI->getDebugLoc(), AS_ASSUMPTION, BB); + } + ConsequenceCondSet = buildConditionSet(ICond->getPredicate(), LHS, RHS, Domain); } |

