diff options
-rw-r--r-- | polly/include/polly/ScopDetectionDiagnostic.h | 27 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 2 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetectionDiagnostic.cpp | 16 |
3 files changed, 44 insertions, 1 deletions
diff --git a/polly/include/polly/ScopDetectionDiagnostic.h b/polly/include/polly/ScopDetectionDiagnostic.h index 7d5da2bf25b..2c5b97536e2 100644 --- a/polly/include/polly/ScopDetectionDiagnostic.h +++ b/polly/include/polly/ScopDetectionDiagnostic.h @@ -70,6 +70,7 @@ enum RejectReasonKind { rrkAffFunc, rrkUndefCond, rrkInvalidCond, + rrkUnsignedCond, rrkUndefOperand, rrkNonAffBranch, rrkNoBasePtr, @@ -356,6 +357,32 @@ public: }; //===----------------------------------------------------------------------===// +/// @brief Captures an condition on unsigned values +/// +/// We do not yet allow conditions on unsigend values +class ReportUnsignedCond : public ReportAffFunc { + //===--------------------------------------------------------------------===// + + // The BasicBlock we found the broken condition in. + BasicBlock *BB; + +public: + ReportUnsignedCond(const Instruction *Inst, BasicBlock *BB) + : ReportAffFunc(rrkUnsignedCond, Inst), BB(BB) {} + + /// @name LLVM-RTTI interface + //@{ + static bool classof(const RejectReason *RR); + //@} + + /// @name RejectReason interface + //@{ + virtual std::string getMessage() const override; + virtual std::string getEndUserMessage() const override; + //@} +}; + +//===----------------------------------------------------------------------===// /// @brief Captures an undefined operand. class ReportUndefOperand : public ReportAffFunc { //===--------------------------------------------------------------------===// diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 4dea7ba4043..88f482b2803 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -351,7 +351,7 @@ bool ScopDetection::isValidCFG(BasicBlock &BB, // TODO: This is not sufficient and just hides bugs. However it does pretty // well. if (ICmp->isUnsigned() && !AllowUnsigned) - return false; + return invalid<ReportUnsignedCond>(Context, /*Assert=*/true, Br, &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 d6539846767..4573e65f2e8 100644 --- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp +++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp @@ -208,6 +208,22 @@ 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 { |