diff options
author | Manish Kausik H <46352931+Nirhar@users.noreply.github.com> | 2024-10-31 23:38:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 11:08:15 -0700 |
commit | 0856592f6f8d2bdaf2d66017d073b8d55fc27552 (patch) | |
tree | a995d195f769a24c4310391a0eeaabd918dbac34 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 25fd366d6a7d40266ff27c134ed8beb0a90cc33b (diff) | |
download | llvm-0856592f6f8d2bdaf2d66017d073b8d55fc27552.zip llvm-0856592f6f8d2bdaf2d66017d073b8d55fc27552.tar.gz llvm-0856592f6f8d2bdaf2d66017d073b8d55fc27552.tar.bz2 |
Ensure `collectTransitivePredecessors` returns Pred only from the Loop. (#113831)
It's possible that we encounter Irreducible control flow, due to which,
we may find that a few predecessors of BB are not a part of the CurLoop.
Currently we crash in the function for such cases. This patch ensures
that we only return Predecessors that are a part of CurLoop and
gracefully ignore other Predecessors.
For example, consider Irreducible IR of this form:
```
define i64 @baz() {
bb:
br label %bb1
bb1: ; preds = %bb3, %bb
br label %bb3
bb2: ; No predecessors!
br label %bb3
bb3: ; preds = %bb2, %bb1
%load = load ptr addrspace(1), ptr addrspace(1) null, align 8
br label %bb1
}
```
This crashes when `collectTransitivePredecessors` is called on the
`%bb1<Header>, %bb3<latch>` loop, because the loop body has a
predecessor `%bb2` which is not a part of the loop.
See https://godbolt.org/z/E9fM1q3cT for the crash
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions