43 if (
auto *GA = dyn_cast<GlobalAlias>(C)) {
44 auto *NewAliasee = canonicalizeAlias(GA->getAliasee(), Changed);
45 if (NewAliasee != GA->getAliasee()) {
46 GA->setAliasee(NewAliasee);
56 std::vector<Constant *> Ops;
57 for (
Use &U :
CE->operands())
58 Ops.push_back(canonicalizeAlias(cast<Constant>(U), Changed));
59 return CE->getWithOperands(Ops);
63 static bool canonicalizeAliases(
Module &M) {
66 canonicalizeAlias(&GA, Changed);
71 class CanonicalizeAliasesLegacyPass :
public ModulePass {
78 StringRef getPassName()
const override {
return "Canonicalize Aliases"; }
80 explicit CanonicalizeAliasesLegacyPass() :
ModulePass(ID) {}
82 bool runOnModule(
Module &M)
override {
return canonicalizeAliases(M); }
90 if (!canonicalizeAliases(M))
97 "Canonicalize aliases",
false,
false)
99 "Canonicalize aliases",
false, false)
103 return new CanonicalizeAliasesLegacyPass();
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
INITIALIZE_PASS_BEGIN(CanonicalizeAliasesLegacyPass, "canonicalize-aliases", "Canonicalize aliases", false, false) INITIALIZE_PASS_END(CanonicalizeAliasesLegacyPass
ModulePass * createCanonicalizeAliasesPass()
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
A Use represents the edge between a Value definition and its users.
Windows NT (Windows on ARM)
A constant value that is initialized with an expression using other constant values.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
A set of analyses that are preserved following a run of a transformation pass.
This is an important base class in LLVM.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
StringRef - Represent a constant reference to a string, i.e.
A container for analyses that lazily runs them and caches their results.
iterator_range< alias_iterator > aliases()