Update prebuilt Clang to r365631c1 from Android.
The version we had was segfaulting.
Bug: 132420445
Change-Id: Icb45a6fe0b4e2166f7895e669df1157cec9fb4e0
diff --git a/linux-x64/clang/include/llvm/ProfileData/InstrProfReader.h b/linux-x64/clang/include/llvm/ProfileData/InstrProfReader.h
index d465420..73751fa 100644
--- a/linux-x64/clang/include/llvm/ProfileData/InstrProfReader.h
+++ b/linux-x64/clang/include/llvm/ProfileData/InstrProfReader.h
@@ -77,6 +77,8 @@
virtual bool isIRLevelProfile() const = 0;
+ virtual bool hasCSIRLevelProfile() const = 0;
+
/// Return the PGO symtab. There are three different readers:
/// Raw, Text, and Indexed profile readers. The first two types
/// of readers are used only by llvm-profdata tool, while the indexed
@@ -89,6 +91,9 @@
/// compiler.
virtual InstrProfSymtab &getSymtab() = 0;
+ /// Compute the sum of counts and return in Sum.
+ void accumuateCounts(CountSumOrPercent &Sum, bool IsCS);
+
protected:
std::unique_ptr<InstrProfSymtab> Symtab;
@@ -142,6 +147,7 @@
/// Iterator over the profile data.
line_iterator Line;
bool IsIRLevelProfile = false;
+ bool HasCSIRLevelProfile = false;
Error readValueProfileData(InstrProfRecord &Record);
@@ -156,6 +162,8 @@
bool isIRLevelProfile() const override { return IsIRLevelProfile; }
+ bool hasCSIRLevelProfile() const override { return HasCSIRLevelProfile; }
+
/// Read the header.
Error readHeader() override;
@@ -212,6 +220,10 @@
return (Version & VARIANT_MASK_IR_PROF) != 0;
}
+ bool hasCSIRLevelProfile() const override {
+ return (Version & VARIANT_MASK_CSIR_PROF) != 0;
+ }
+
InstrProfSymtab &getSymtab() override {
assert(Symtab.get());
return *Symtab.get();
@@ -341,6 +353,7 @@
virtual void setValueProfDataEndianness(support::endianness Endianness) = 0;
virtual uint64_t getVersion() const = 0;
virtual bool isIRLevelProfile() const = 0;
+ virtual bool hasCSIRLevelProfile() const = 0;
virtual Error populateSymtab(InstrProfSymtab &) = 0;
};
@@ -385,6 +398,10 @@
return (FormatVersion & VARIANT_MASK_IR_PROF) != 0;
}
+ bool hasCSIRLevelProfile() const override {
+ return (FormatVersion & VARIANT_MASK_CSIR_PROF) != 0;
+ }
+
Error populateSymtab(InstrProfSymtab &Symtab) override {
return Symtab.create(HashTable->keys());
}
@@ -412,13 +429,16 @@
std::unique_ptr<InstrProfReaderRemapper> Remapper;
/// Profile summary data.
std::unique_ptr<ProfileSummary> Summary;
+ /// Context sensitive profile summary data.
+ std::unique_ptr<ProfileSummary> CS_Summary;
// Index to the current record in the record array.
unsigned RecordIndex;
// Read the profile summary. Return a pointer pointing to one byte past the
// end of the summary data if it exists or the input \c Cur.
+ // \c UseCS indicates whether to use the context-sensitive profile summary.
const unsigned char *readSummary(IndexedInstrProf::ProfVersion Version,
- const unsigned char *Cur);
+ const unsigned char *Cur, bool UseCS);
public:
IndexedInstrProfReader(
@@ -432,6 +452,9 @@
/// Return the profile version.
uint64_t getVersion() const { return Index->getVersion(); }
bool isIRLevelProfile() const override { return Index->isIRLevelProfile(); }
+ bool hasCSIRLevelProfile() const override {
+ return Index->hasCSIRLevelProfile();
+ }
/// Return true if the given buffer is in an indexed instrprof format.
static bool hasFormat(const MemoryBuffer &DataBuffer);
@@ -450,7 +473,16 @@
std::vector<uint64_t> &Counts);
/// Return the maximum of all known function counts.
- uint64_t getMaximumFunctionCount() { return Summary->getMaxFunctionCount(); }
+ /// \c UseCS indicates whether to use the context-sensitive count.
+ uint64_t getMaximumFunctionCount(bool UseCS) {
+ if (UseCS) {
+ assert(CS_Summary && "No context sensitive profile summary");
+ return CS_Summary->getMaxFunctionCount();
+ } else {
+ assert(Summary && "No profile summary");
+ return Summary->getMaxFunctionCount();
+ }
+ }
/// Factory method to create an indexed reader.
static Expected<std::unique_ptr<IndexedInstrProfReader>>
@@ -469,7 +501,18 @@
// to be used by llvm-profdata (for dumping). Avoid using this when
// the client is the compiler.
InstrProfSymtab &getSymtab() override;
- ProfileSummary &getSummary() { return *(Summary.get()); }
+
+ /// Return the profile summary.
+ /// \c UseCS indicates whether to use the context-sensitive summary.
+ ProfileSummary &getSummary(bool UseCS) {
+ if (UseCS) {
+ assert(CS_Summary && "No context sensitive summary");
+ return *(CS_Summary.get());
+ } else {
+ assert(Summary && "No profile summary");
+ return *(Summary.get());
+ }
+ }
};
} // end namespace llvm