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
25 changes: 16 additions & 9 deletions jlm/llvm/ir/Trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,39 @@ OutputTracer::OutputTracer()
: rvsdg::OutputTracer()
{}

rvsdg::Output &
OutputTracer::traceStep(rvsdg::Output & output, const rvsdg::Region * withinRegion)
OutputTracer::TraceStepResult
OutputTracer::traceStep(
rvsdg::Output & output,
BackEdgeState backEdgeState,
const rvsdg::Region * withinRegion)
{
auto & trace1 = rvsdg::OutputTracer::traceStep(output, withinRegion);
const auto trace1 = rvsdg::OutputTracer::traceStep(output, backEdgeState, withinRegion);
auto & trace1Output = trace1.getOutput();

if (const auto [node, ioBarrierOp] =
rvsdg::TryGetSimpleNodeAndOptionalOp<IOBarrierOperation>(trace1);
rvsdg::TryGetSimpleNodeAndOptionalOp<IOBarrierOperation>(trace1Output);
node && ioBarrierOp)
{
return *IOBarrierOperation::BarredInput(*node).origin();
return TraceStepResult::createStepResult(*IOBarrierOperation::BarredInput(*node).origin());
}

// If enabled, try tracing through the memory states of load nodes
if (traceThroughLoadedStates_)
{
if (const auto [node, loadOp] = rvsdg::TryGetSimpleNodeAndOptionalOp<LoadOperation>(trace1);
if (const auto [node, loadOp] =
rvsdg::TryGetSimpleNodeAndOptionalOp<LoadOperation>(trace1Output);
node && loadOp)
{
if (is<MemoryStateType>(trace1.Type()))
if (is<MemoryStateType>(trace1Output.Type()))
{
// Map the memory state output to the corresponding memory state input
auto & memoryStateInput = LoadOperation::MapMemoryStateOutputToInput(trace1);
return *memoryStateInput.origin();
auto & memoryStateInput = LoadOperation::MapMemoryStateOutputToInput(trace1Output);
return TraceStepResult::createStepResult(*memoryStateInput.origin());
}
}
}

// We were not able to make any extra progress on the trace result, so return it as is
return trace1;
}

Expand All @@ -66,6 +72,7 @@ traceOutput(rvsdg::Output & output, bool mayEnterSubregions, const rvsdg::Region
mayEnterSubregions
? rvsdg::OutputTracer::StructuralNodePolicy::traceIntoSubregions
: rvsdg::OutputTracer::StructuralNodePolicy::traceThroughIfDetectedInvariant);
tracer.setRegionPredicateCheckingEnabled(mayEnterSubregions);
tracer.setEnterPhiNodes(mayEnterSubregions);
return tracer.trace(output, withinRegion);
}
Expand Down
5 changes: 3 additions & 2 deletions jlm/llvm/ir/Trace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class OutputTracer : public rvsdg::OutputTracer
}

protected:
[[nodiscard]] rvsdg::Output &
traceStep(rvsdg::Output & output, const rvsdg::Region * withinRegion) override;
[[nodiscard]] TraceStepResult
traceStep(rvsdg::Output & output, BackEdgeState backEdgeState, const rvsdg::Region * withinRegion)
override;

private:
bool traceThroughLoadedStates_ = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@

#include <unordered_map>

namespace jlm::util
{
class GraphWriter;
}

namespace jlm::llvm::aa
{

Expand Down
Loading
Loading