[polly] r215625 - Use a snapshot of the aliasing pointers
Andreas Simbuerger
simbuerg at fim.uni-passau.de
Thu Aug 14 01:53:12 PDT 2014
Author: simbuerg
Date: Thu Aug 14 03:53:12 2014
New Revision: 215625
URL: http://llvm.org/viewvc/llvm-project?rev=215625&view=rev
Log:
Use a snapshot of the aliasing pointers
Store the llvm::Value pointers of the AliasSet instead of the AliasSet
itself.
We have to be careful about changed IR when the message is generated,
because the Value pointers might not exist anymore. This would render
the Diagnostic invalid. For now we just assert there.
Simply do not retreive a diagnostic message after the IR has changed
it's not valid information anyway.
Modified:
polly/trunk/include/polly/ScopDetectionDiagnostic.h
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=215625&r1=215624&r2=215625&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetectionDiagnostic.h (original)
+++ polly/trunk/include/polly/ScopDetectionDiagnostic.h Thu Aug 14 03:53:12 2014
@@ -657,19 +657,24 @@ public:
/// @brief Captures errors with aliasing.
class ReportAlias : public RejectReason {
//===--------------------------------------------------------------------===//
+public:
+ typedef std::vector<const llvm::Value *> PointerSnapshotTy;
+private:
/// @brief Format an invalid alias set.
///
/// @param AS The invalid alias set to format.
- std::string formatInvalidAlias(AliasSet &AS) const;
+ std::string formatInvalidAlias() const;
Instruction *Inst;
- AliasSet &AS;
+
+ // A snapshot of the llvm values that took part in the aliasing error.
+ mutable PointerSnapshotTy Pointers;
public:
ReportAlias(Instruction *Inst, AliasSet &AS);
- AliasSet &getAliasSet() { return AS; }
+ const PointerSnapshotTy &getPointers() const { return Pointers; }
/// @name LLVM-RTTI interface
//@{
Modified: polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp?rev=215625&r1=215624&r2=215625&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp Thu Aug 14 03:53:12 2014
@@ -427,27 +427,27 @@ bool ReportFuncCall::classof(const Rejec
// ReportAlias.
ReportAlias::ReportAlias(Instruction *Inst, AliasSet &AS)
- : RejectReason(rrkAlias), Inst(Inst), AS(AS) {
+ : RejectReason(rrkAlias), Inst(Inst) {
+
+ for (const auto &I : AS)
+ Pointers.push_back(I.getValue());
+
++BadAliasForScop;
}
-std::string ReportAlias::formatInvalidAlias(AliasSet &AS) const {
+std::string ReportAlias::formatInvalidAlias() const {
std::string Message;
raw_string_ostream OS(Message);
OS << "Possible aliasing: ";
- std::vector<Value *> Pointers;
-
- for (const auto &I : AS)
- Pointers.push_back(I.getValue());
-
std::sort(Pointers.begin(), Pointers.end());
- for (std::vector<Value *>::iterator PI = Pointers.begin(),
- PE = Pointers.end();
+ for (PointerSnapshotTy::const_iterator PI = Pointers.begin(),
+ PE = Pointers.end();
;) {
- Value *V = *PI;
+ const Value *V = *PI;
+ assert(V && "Diagnostic info does not match found LLVM-IR anymore.");
if (V->getName().size() == 0)
OS << "\"" << *V << "\"";
@@ -465,7 +465,7 @@ std::string ReportAlias::formatInvalidAl
return OS.str();
}
-std::string ReportAlias::getMessage() const { return formatInvalidAlias(AS); }
+std::string ReportAlias::getMessage() const { return formatInvalidAlias(); }
const DebugLoc &ReportAlias::getDebugLoc() const { return Inst->getDebugLoc(); }
More information about the llvm-commits
mailing list