Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions bolt/include/bolt/Passes/DataflowAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,17 @@ class DataflowAnalysis {
/// Relies on a ptr map to fetch the previous instruction and then retrieve
/// state. WARNING: Watch out for invalidated pointers. Do not use this
/// function if you invalidated pointers after the analysis has been completed
ErrorOr<const StateTy &> getStateBefore(const MCInst &Point) {
return getStateAt(PrevPoint[&Point]);
ErrorOr<const StateTy &> getStateBefore(const MCInst &Point) const {
auto It = PrevPoint.find(&Point);
if (It == PrevPoint.end())
return make_error_code(std::errc::result_out_of_range);
return getStateAt(It->getSecond());
}

ErrorOr<const StateTy &> getStateBefore(ProgramPoint Point) {
ErrorOr<const StateTy &> getStateBefore(ProgramPoint Point) const {
if (Point.isBB())
return getStateAt(*Point.getBB());
return getStateAt(PrevPoint[Point.getInst()]);
return getStateBefore(*Point.getInst());
}

/// Remove any state annotations left by this analysis
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/Passes/PAuthGadgetScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class PacRetAnalysis
public:
std::vector<MCInstReference>
getLastClobberingInsts(const MCInst &Inst, BinaryFunction &BF,
const ArrayRef<MCPhysReg> UsedDirtyRegs) {
const ArrayRef<MCPhysReg> UsedDirtyRegs) const {
if (RegsToTrackInstsFor.empty())
return {};
auto MaybeState = getStateBefore(Inst);
Expand Down