[polly] r237800 - Add diagnostic for unsigned integer comparisions
Tobias Grosser
tobias at grosser.es
Wed May 20 08:37:11 PDT 2015
Author: grosser
Date: Wed May 20 10:37:11 2015
New Revision: 237800
URL: http://llvm.org/viewvc/llvm-project?rev=237800&view=rev
Log:
Add diagnostic for unsigned integer comparisions
Modified:
polly/trunk/include/polly/ScopDetectionDiagnostic.h
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
Modified: polly/trunk/include/polly/ScopDetectionDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetectionDiagnostic.h?rev=237800&r1=237799&r2=237800&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetectionDiagnostic.h (original)
+++ polly/trunk/include/polly/ScopDetectionDiagnostic.h Wed May 20 10:37:11 2015
@@ -70,6 +70,7 @@ enum RejectReasonKind {
rrkAffFunc,
rrkUndefCond,
rrkInvalidCond,
+ rrkUnsignedCond,
rrkUndefOperand,
rrkNonAffBranch,
rrkNoBasePtr,
@@ -355,6 +356,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 {
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=237800&r1=237799&r2=237800&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Wed May 20 10:37:11 2015
@@ -351,7 +351,7 @@ bool ScopDetection::isValidCFG(BasicBloc
// 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)) ||
Modified: polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp?rev=237800&r1=237799&r2=237800&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp Wed May 20 10:37:11 2015
@@ -208,6 +208,22 @@ bool ReportInvalidCond::classof(const Re
}
//===----------------------------------------------------------------------===//
+// 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 {
More information about the llvm-commits
mailing list