summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp6
-rw-r--r--llvm/lib/CodeGen/ScheduleDAGInstrs.cpp27
2 files changed, 21 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e505b1cc5a1..d9e164500c3 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3430,7 +3430,8 @@ static const Value *getUnderlyingObjectFromInt(const Value *V) {
/// This is a wrapper around GetUnderlyingObjects and adds support for basic
/// ptrtoint+arithmetic+inttoptr sequences.
-void llvm::getUnderlyingObjectsForCodeGen(const Value *V,
+/// It returns false if unidentified object is found in GetUnderlyingObjects.
+bool llvm::getUnderlyingObjectsForCodeGen(const Value *V,
SmallVectorImpl<Value *> &Objects,
const DataLayout &DL) {
SmallPtrSet<const Value *, 16> Visited;
@@ -3456,11 +3457,12 @@ void llvm::getUnderlyingObjectsForCodeGen(const Value *V,
// getUnderlyingObjectsForCodeGen also fails for safety.
if (!isIdentifiedObject(V)) {
Objects.clear();
- return;
+ return false;
}
Objects.push_back(const_cast<Value *>(V));
}
} while (!Working.empty());
+ return true;
}
/// Return true if the only users of this pointer are lifetime markers.
diff --git a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
index 08b785d742a..be129b8766a 100644
--- a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
+++ b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -121,9 +121,11 @@ ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction &mf,
SchedModel.init(ST.getSchedModel(), &ST, TII);
}
-/// If this machine instr has memory reference information and it can be tracked
-/// to a normal reference to a known object, return the Value for that object.
-static void getUnderlyingObjectsForInstr(const MachineInstr *MI,
+/// If this machine instr has memory reference information and it can be
+/// tracked to a normal reference to a known object, return the Value
+/// for that object. This function returns false the memory location is
+/// unknown or may alias anything.
+static bool getUnderlyingObjectsForInstr(const MachineInstr *MI,
const MachineFrameInfo &MFI,
UnderlyingObjectsVector &Objects,
const DataLayout &DL) {
@@ -151,7 +153,8 @@ static void getUnderlyingObjectsForInstr(const MachineInstr *MI,
Objects.push_back(UnderlyingObjectsVector::value_type(PSV, MayAlias));
} else if (const Value *V = MMO->getValue()) {
SmallVector<Value *, 4> Objs;
- getUnderlyingObjectsForCodeGen(V, Objs, DL);
+ if (!getUnderlyingObjectsForCodeGen(V, Objs, DL))
+ return false;
for (Value *V : Objs) {
assert(isIdentifiedObject(V));
@@ -163,8 +166,12 @@ static void getUnderlyingObjectsForInstr(const MachineInstr *MI,
return true;
};
- if (!allMMOsOkay())
+ if (!allMMOsOkay()) {
Objects.clear();
+ return false;
+ }
+
+ return true;
}
void ScheduleDAGInstrs::startBlock(MachineBasicBlock *bb) {
@@ -860,13 +867,13 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA,
// Find the underlying objects for MI. The Objs vector is either
// empty, or filled with the Values of memory locations which this
- // SU depends on. An empty vector means the memory location is
- // unknown, and may alias anything.
+ // SU depends on.
UnderlyingObjectsVector Objs;
- getUnderlyingObjectsForInstr(&MI, MFI, Objs, MF.getDataLayout());
+ bool ObjsFound = getUnderlyingObjectsForInstr(&MI, MFI, Objs,
+ MF.getDataLayout());
if (MI.mayStore()) {
- if (Objs.empty()) {
+ if (!ObjsFound) {
// An unknown store depends on all stores and loads.
addChainDependencies(SU, Stores);
addChainDependencies(SU, NonAliasStores);
@@ -901,7 +908,7 @@ void ScheduleDAGInstrs::buildSchedGraph(AliasAnalysis *AA,
addChainDependencies(SU, Stores, UnknownValue);
}
} else { // SU is a load.
- if (Objs.empty()) {
+ if (!ObjsFound) {
// An unknown load depends on all stores.
addChainDependencies(SU, Stores);
addChainDependencies(SU, NonAliasStores);
OpenPOWER on IntegriCloud