Closes #147869 Closes #149679 Adds a check for a missing loop preheader during analysis. This fixes a nullptr dereference that happened whenever LoopSimplify was unable to generate a preheader because the loop was entered by an indirectbr instruction (as stated in the LoopSimplify.cpp doc comment).
29 lines
887 B
LLVM
29 lines
887 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes='require<domtree>,loop(loop-simplifycfg)' -verify-loop-info -verify-dom-info -verify-loop-lcssa < %s | FileCheck %s
|
|
|
|
define void @test(ptr %addr) {
|
|
; CHECK-LABEL: define void @test(
|
|
; CHECK-SAME: ptr [[ADDR:%.*]]) {
|
|
; CHECK-NEXT: indirectbr ptr [[ADDR]], [label %[[A:.*]], label %C]
|
|
; CHECK: [[A]]:
|
|
; CHECK-NEXT: br i1 true, label %[[B:.*]], label %[[C_LOOPEXIT:.*]]
|
|
; CHECK: [[B]]:
|
|
; CHECK-NEXT: br i1 true, label %[[A]], label %[[C_LOOPEXIT]]
|
|
; CHECK: [[C_LOOPEXIT]]:
|
|
; CHECK-NEXT: br label %[[C:.*]]
|
|
; CHECK: [[C]]:
|
|
; CHECK-NEXT: unreachable
|
|
;
|
|
|
|
indirectbr ptr %addr, [label %A, label %C]
|
|
|
|
A:
|
|
br i1 true, label %B, label %C
|
|
|
|
B:
|
|
br i1 true, label %A, label %C
|
|
|
|
C:
|
|
unreachable
|
|
}
|