mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
Mirror of https://github.com/RPCS3/llvm-mirror
ef1046fdfe
Summary: Blocks in a loop can be in any order as long as the loop header is the first block in Blocks. With some order of Blocks, cloneLoopWithPreheader would trigger the assertion in addBasicBlockToLoop. Example: define void @test(i64 %N) { preheader.i: br label %header.i header.i: %i = phi i64 [ 0, %preheader.i ], [ %inc.i, %latch.i ] br label %header.j header.j: %j = phi i64 [ 0, %header.i ], [ %inc.j, %latch.j ] br label %header.k header.k: %k = phi i64 [ 0, %header.j ], [ %inc.k, %latch.k ] call void @baz(i64 %i, i64 %j, i64 %k) br label %latch.k latch.k: %inc.k = add nsw i64 %k, 1 %cmp.k = icmp slt i64 %inc.k, %N br i1 %cmp.k, label %header.k, label %latch.j latch.j: %inc.j = add nsw i64 %j, 1 %cmp.j = icmp slt i64 %inc.j, %N br i1 %cmp.j, label %header.j, label %latch.i latch.i: %inc.i = add nsw i64 %i, 1 %cmp.i = icmp slt i64 %inc.i, %N br i1 %cmp.i, label %header.i, label %exit.i exit.i: ret void } declare void @baz(i64, i64, i64) If the blocks of loop-i is in the order: header.i, latch.k, header.k, header.j, latch.j, latch.i, then cloneLoopWithPreheader would trigger the assertion in addBasicBlockToLoop assert(contains(SameHeader) && getHeader() == SameHeader->getHeader() && "Incorrect LI specified for this loop!"); As latch.k is in both loop-j and loop-k, it would be set as the header of both loops after adding latch.k. If we update loop headers during cloning blocks, then after adding header.k, the header of loop-k would be updated with header.k, while the header of loop-j stays as latch.k. When adding header.j, SameHeader is loop-k, SameHeader->getHeader() is header.k, but getHeader() is latch.k, which trigger the assertion. Reviewer: jdoerfert, Meinersbur, fhahn, kbarton, hfinkel, bmahjour, etiotto Reviewed By: Meinersbur Subscribers: hiraditya, llvm-commits Tag: LLVM Differential Revision: https://reviews.llvm.org/D74382 |
||
---|---|---|
benchmarks | ||
bindings | ||
cmake | ||
docs | ||
examples | ||
include | ||
lib | ||
projects | ||
resources | ||
runtimes | ||
test | ||
tools | ||
unittests | ||
utils | ||
.arcconfig | ||
.clang-format | ||
.clang-tidy | ||
.gitattributes | ||
.gitignore | ||
CMakeLists.txt | ||
CODE_OWNERS.TXT | ||
configure | ||
CREDITS.TXT | ||
LICENSE.TXT | ||
llvm.spec.in | ||
LLVMBuild.txt | ||
README.txt | ||
RELEASE_TESTERS.TXT |
The LLVM Compiler Infrastructure ================================ This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments. LLVM is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. Please see the documentation provided in docs/ for further assistance with LLVM, and in particular docs/GettingStarted.rst for getting started with LLVM and docs/README.txt for an overview of LLVM's documentation setup. If you are writing a package for LLVM, see docs/Packaging.rst for our suggestions.