Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
5 changed files
with
61 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
; 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters