diff options
author | AidinT <at.aidin@gmail.com> | 2024-12-12 16:25:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 16:25:09 +0100 |
commit | 6f8a363a483489687597e29b8bda0975e821f188 (patch) | |
tree | ccb122632304685af01adddc38d295dd68815c67 /llvm/docs/tutorial | |
parent | bc28be0a428020ea803c94adb4df48ee4972e9f1 (diff) | |
download | llvm-6f8a363a483489687597e29b8bda0975e821f188.zip llvm-6f8a363a483489687597e29b8bda0975e821f188.tar.gz llvm-6f8a363a483489687597e29b8bda0975e821f188.tar.bz2 |
[Kaleidoscope] Add mem2reg pass to function pass manager (#119707)
Kaleidoscope has switched to new pass manager before (#72324), but both
code and tutorial document have some missing parts.
This pull request fixes the following problems:
1. Adds `PromotePass` to the function pass manager. This pass was
removed during the switch from legacy pass manager to the new pass
manager.
2. Syncs the tutorial with the code.
Diffstat (limited to 'llvm/docs/tutorial')
-rw-r--r-- | llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst index 8fd4c39d..ed1dea2 100644 --- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst +++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst @@ -336,7 +336,7 @@ the function: /// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of /// the function. This is used for mutable variables etc. static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction, - const std::string &VarName) { + StringRef VarName) { IRBuilder<> TmpB(&TheFunction->getEntryBlock(), TheFunction->getEntryBlock().begin()); return TmpB.CreateAlloca(Type::getDoubleTy(*TheContext), nullptr, @@ -440,11 +440,11 @@ get good codegen once again: .. code-block:: c++ // Promote allocas to registers. - TheFPM->add(createPromoteMemoryToRegisterPass()); + TheFPM->addPass(PromotePass()); // Do simple "peephole" optimizations and bit-twiddling optzns. - TheFPM->add(createInstructionCombiningPass()); + TheFPM->addPass(InstCombinePass()); // Reassociate expressions. - TheFPM->add(createReassociatePass()); + TheFPM->addPass(ReassociatePass()); ... It is interesting to see what the code looks like before and after the |