diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp --- a/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp @@ -744,13 +744,11 @@ // Remove AlignRelaxable edges: all other relaxable edges got modified and // will be used later while linking. Alignment is entirely handled here so we // don't need these edges anymore. - for (auto *B : G.blocks()) { - for (auto IE = B->edges().begin(); IE != B->edges().end();) { - if (IE->getKind() == AlignRelaxable) - IE = B->removeEdge(IE); - else - ++IE; - } + for (auto IE = Block.edges().begin(); IE != Block.edges().end();) { + if (IE->getKind() == AlignRelaxable) + IE = Block.removeEdge(IE); + else + ++IE; } }