[llvm] [SPIR-V] Fix BB ordering & register lifetime (PR #111026)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 11:45:30 PDT 2024
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>,
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/111026 at github.com>
================
@@ -447,55 +439,51 @@ class SPIRVStructurizer : public FunctionPass {
// clang-format on
std::vector<Edge>
createAliasBlocksForComplexEdges(std::vector<Edge> Edges) {
- std::unordered_map<BasicBlock *, BasicBlock *> Seen;
+ std::unordered_set<BasicBlock *> Seen;
std::vector<Edge> Output;
Output.reserve(Edges.size());
for (auto &[Src, Dst] : Edges) {
- auto [iterator, inserted] = Seen.insert({Src, Dst});
- if (inserted) {
- Output.emplace_back(Src, Dst);
- continue;
+ auto [iterator, inserted] = Seen.insert(Src);
+ if (!inserted) {
+ // Src already a source node. Cannot have 2 edges from A to B.
+ // Creating alias source block.
+ BasicBlock *NewSrc =
+ BasicBlock::Create(F.getContext(), "new.src", &F);
----------------
VyacheslavLevytskyy wrote:
Not sure about this random hard coded name for BB. I'd understand it either empty, or basing on the `Src` name (as an option, Src->printAsOperand()), or as a prefix with numbering, or anything except for the hard coded and the same for all transformation cases.
Please feel to ignore this if you see why the current version is better, because I can imagine a case when "new.src" makes sense.
https://github.com/llvm/llvm-project/pull/111026
More information about the llvm-commits
mailing list