Files
clang-p2996/llvm/test/Analysis/LazyCallGraph/blockaddress.ll
Arthur Eubanks 029f1a5344 [LazyCallGraph] Skip blockaddresses
blockaddresses do not participate in the call graph since the only
instructions that use them must all return to someplace within the
current function. And passes cannot retrieve a function address from a
blockaddress.

This was suggested by efriedma in D58260.

Fixes PR50881.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D112178
2021-11-01 13:10:24 -07:00

29 lines
910 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes="cgscc(function(sccp,simplifycfg))" < %s -S | FileCheck %s
define i32 @baz(i32 %y, i1 %b) {
; CHECK-LABEL: @baz(
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[B:%.*]], label [[LAB:%.*]], label [[FOR_COND:%.*]]
; CHECK: for.cond:
; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ null, [[FOR_COND]] ], [ blockaddress(@baz, [[LAB]]), [[ENTRY:%.*]] ]
; CHECK-NEXT: [[INCDEC_PTR:%.*]] = getelementptr inbounds i8, i8* [[P_0]], i64 1
; CHECK-NEXT: br label [[FOR_COND]]
; CHECK: lab:
; CHECK-NEXT: ret i32 0
;
entry:
br i1 %b, label %lab, label %for.cond.preheader
for.cond.preheader:
br label %for.cond
for.cond:
%p.0 = phi i8* [ null, %for.cond ], [ blockaddress(@baz, %lab), %for.cond.preheader ]
%incdec.ptr = getelementptr inbounds i8, i8* %p.0, i64 1
br label %for.cond
lab:
ret i32 0
}