LLVM 22.0.0git
TransactionAlwaysRevert.h
Go to the documentation of this file.
1//===- TransactionAlwaysRevert.h --------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is a region pass that always reverts the transaction without checking
10// its cost. This is mainly used as a final pass in lit tests.
11//
12
13#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_TRANSACTIONALWAYSREVERT_H
14#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_TRANSACTIONALWAYSREVERT_H
15
16#include "llvm/SandboxIR/Pass.h"
18
19namespace llvm::sandboxir {
20
22public:
24 bool runOnRegion(Region &Rgn, const Analyses &A) final {
25 auto &Tracker = Rgn.getContext().getTracker();
26 bool HasChanges = !Tracker.empty();
28 return HasChanges;
29 }
30};
31
32} // namespace llvm::sandboxir
33
34#endif // LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_PASSES_TRANSACTIONALWAYSREVERT_H
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Tracker & getTracker()
Definition: Context.h:245
A pass that runs on a sandbox::Region.
Definition: Pass.h:84
The main job of the Region is to point to new instructions generated by vectorization passes.
Definition: Region.h:96
The tracker collects all the change objects and implements the main API for saving / reverting / acce...
Definition: Tracker.h:442
LLVM_ABI void revert()
Stops tracking and reverts to saved state.
Definition: Tracker.cpp:346
bool empty() const
\Returns true if there are no changes tracked.
Definition: Tracker.h:480
Context & getContext() const
Definition: Tracker.h:478
bool runOnRegion(Region &Rgn, const Analyses &A) final
\Returns true if it modifies R.