Mark internal classes as POD-like to get better behavior out of

SmallVector and DenseMap.

This speeds up SROA by 25% on PR15412.

llvm-svn: 177259
This commit is contained in:
Chandler Carruth 2013-03-18 08:36:46 +00:00
parent 97423324fa
commit 1d83f79b3d

View File

@ -69,16 +69,6 @@ static cl::opt<bool>
ForceSSAUpdater("force-ssa-updater", cl::init(false), cl::Hidden);
namespace {
/// \brief Alloca partitioning representation.
///
/// This class represents a partitioning of an alloca into slices, and
/// information about the nature of uses of each slice of the alloca. The goal
/// is that this information is sufficient to decide if and how to split the
/// alloca apart and replace slices with scalars. It is also intended that this
/// structure can capture the relevant information needed both to decide about
/// and to enact these transformations.
class AllocaPartitioning {
public:
/// \brief A common base class for representing a half-open byte range.
struct ByteRange {
/// \brief The beginning offset of the range.
@ -185,7 +175,24 @@ public:
/// \brief Whether this use is split across multiple partitions.
bool isSplit() const { return UsePtrAndIsSplit.getInt(); }
};
}
namespace llvm {
template <> struct isPodLike<Partition> : llvm::true_type {};
template <> struct isPodLike<PartitionUse> : llvm::true_type {};
}
namespace {
/// \brief Alloca partitioning representation.
///
/// This class represents a partitioning of an alloca into slices, and
/// information about the nature of uses of each slice of the alloca. The goal
/// is that this information is sufficient to decide if and how to split the
/// alloca apart and replace slices with scalars. It is also intended that this
/// structure can capture the relevant information needed both to decide about
/// and to enact these transformations.
class AllocaPartitioning {
public:
/// \brief Construct a partitioning of a particular alloca.
///
/// Construction does most of the work for partitioning the alloca. This
@ -1389,7 +1396,7 @@ public:
// may be grown during speculation. However, we never need to re-visit the
// new uses, and so we can use the initial size bound.
for (unsigned Idx = 0, Size = P.use_size(PI); Idx != Size; ++Idx) {
const AllocaPartitioning::PartitionUse &PU = P.getUse(PI, Idx);
const PartitionUse &PU = P.getUse(PI, Idx);
if (!PU.getUse())
continue; // Skip dead use.
@ -1594,7 +1601,7 @@ private:
IRBuilder<> IRB(&SI);
Use *Ops[2] = { &SI.getOperandUse(1), &SI.getOperandUse(2) };
AllocaPartitioning::iterator PIs[2];
AllocaPartitioning::PartitionUse PUs[2];
PartitionUse PUs[2];
for (unsigned i = 0, e = 2; i != e; ++i) {
PIs[i] = P.findPartitionForPHIOrSelectOperand(Ops[i]);
if (PIs[i] != P.end()) {