summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachinePipeliner.cpp
diff options
context:
space:
mode:
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>2019-04-24 06:55:50 +0000
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>2019-04-24 06:55:50 +0000
commit71e8c6f20fe4c5d9cfd6235c360d602f0d29a6ab (patch)
tree733de499705847250087e8f5a20cb95267c2e819 /llvm/lib/CodeGen/MachinePipeliner.cpp
parent1e413ffa7bc8939af283ab54a5dfe7ede54b1ec7 (diff)
downloadbcm5719-llvm-71e8c6f20fe4c5d9cfd6235c360d602f0d29a6ab.tar.gz
bcm5719-llvm-71e8c6f20fe4c5d9cfd6235c360d602f0d29a6ab.zip
Add "const" in GetUnderlyingObjects. NFC
Summary: Both the input Value pointer and the returned Value pointers in GetUnderlyingObjects are now declared as const. It turned out that all current (in-tree) uses of GetUnderlyingObjects were trivial to update, being satisfied with have those Value pointers declared as const. Actually, in the past several of the users had to use const_cast, just because of ValueTracking not providing a version of GetUnderlyingObjects with "const" Value pointers. With this patch we get rid of those const casts. Reviewers: hfinkel, materi, jkorous Reviewed By: jkorous Subscribers: dexonsmith, jkorous, jholewinski, sdardis, eraman, hiraditya, jrtc27, atanasyan, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61038 llvm-svn: 359072
Diffstat (limited to 'llvm/lib/CodeGen/MachinePipeliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachinePipeliner.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 62760d222a8..9c1a5a73375 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -541,16 +541,16 @@ static bool isDependenceBarrier(MachineInstr &MI, AliasAnalysis *AA) {
/// Return the underlying objects for the memory references of an instruction.
/// This function calls the code in ValueTracking, but first checks that the
/// instruction has a memory operand.
-static void getUnderlyingObjects(MachineInstr *MI,
- SmallVectorImpl<Value *> &Objs,
+static void getUnderlyingObjects(const MachineInstr *MI,
+ SmallVectorImpl<const Value *> &Objs,
const DataLayout &DL) {
if (!MI->hasOneMemOperand())
return;
MachineMemOperand *MM = *MI->memoperands_begin();
if (!MM->getValue())
return;
- GetUnderlyingObjects(const_cast<Value *>(MM->getValue()), Objs, DL);
- for (Value *V : Objs) {
+ GetUnderlyingObjects(MM->getValue(), Objs, DL);
+ for (const Value *V : Objs) {
if (!isIdentifiedObject(V)) {
Objs.clear();
return;
@@ -564,7 +564,7 @@ static void getUnderlyingObjects(MachineInstr *MI,
/// dependence. This code is very similar to the code in ScheduleDAGInstrs
/// but that code doesn't create loop carried dependences.
void SwingSchedulerDAG::addLoopCarriedDependences(AliasAnalysis *AA) {
- MapVector<Value *, SmallVector<SUnit *, 4>> PendingLoads;
+ MapVector<const Value *, SmallVector<SUnit *, 4>> PendingLoads;
Value *UnknownValue =
UndefValue::get(Type::getVoidTy(MF.getFunction().getContext()));
for (auto &SU : SUnits) {
@@ -572,7 +572,7 @@ void SwingSchedulerDAG::addLoopCarriedDependences(AliasAnalysis *AA) {
if (isDependenceBarrier(MI, AA))
PendingLoads.clear();
else if (MI.mayLoad()) {
- SmallVector<Value *, 4> Objs;
+ SmallVector<const Value *, 4> Objs;
getUnderlyingObjects(&MI, Objs, MF.getDataLayout());
if (Objs.empty())
Objs.push_back(UnknownValue);
@@ -581,12 +581,12 @@ void SwingSchedulerDAG::addLoopCarriedDependences(AliasAnalysis *AA) {
SUs.push_back(&SU);
}
} else if (MI.mayStore()) {
- SmallVector<Value *, 4> Objs;
+ SmallVector<const Value *, 4> Objs;
getUnderlyingObjects(&MI, Objs, MF.getDataLayout());
if (Objs.empty())
Objs.push_back(UnknownValue);
for (auto V : Objs) {
- MapVector<Value *, SmallVector<SUnit *, 4>>::iterator I =
+ MapVector<const Value *, SmallVector<SUnit *, 4>>::iterator I =
PendingLoads.find(V);
if (I == PendingLoads.end())
continue;
OpenPOWER on IntegriCloud