Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=6 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM

; Most reduced from the OpenMC app running OpenMP offloading code, caused crashes before as we
; mixed local and remote (=intra and inter procedural) values.

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

%S = type { ptr }
%S.2 = type { ptr, i64, i64 }
%struct1 = type { %struct2 }
%struct2 = type <{ ptr, i64, i64, i32, [4 x i8] }>

define i64 @t1(ptr %first, ptr %first.addr, ptr %0) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT____-LABEL: define {{[^@]+}}@t1
; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nocapture nofree readnone [[FIRST_ADDR:%.*]], ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    store ptr [[FIRST]], ptr [[FIRST]], align 8
; IS__TUNIT____-NEXT:    br label [[IF_END:%.*]]
; IS__TUNIT____:       if.end:
; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR3:[0-9]+]]
; IS__TUNIT____-NEXT:    ret i64 0
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
; IS__CGSCC____-LABEL: define {{[^@]+}}@t1
; IS__CGSCC____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nocapture nofree readnone [[FIRST_ADDR:%.*]], ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC____-NEXT:    store ptr [[FIRST]], ptr [[FIRST]], align 8
; IS__CGSCC____-NEXT:    br label [[IF_END:%.*]]
; IS__CGSCC____:       if.end:
; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR6:[0-9]+]]
; IS__CGSCC____-NEXT:    [[ADD_PTR:%.*]] = getelementptr inbounds double, ptr [[CALL]], i64 -1
; IS__CGSCC____-NEXT:    ret i64 0
;
entry:
  %first.addr1 = alloca ptr, i32 0, align 8
  store ptr %first, ptr %first, align 8
  br label %if.end

if.end:                                           ; preds = %entry
  %1 = load ptr, ptr %first, align 8
  %call = call ptr @foo.4(ptr %first)
  %add.ptr = getelementptr inbounds double, ptr %call, i64 -1
  ret i64 0
}

define internal ptr @foo.4(ptr %__first) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT____-LABEL: define {{[^@]+}}@foo.4
; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    store ptr [[__FIRST]], ptr [[__FIRST]], align 8
; IS__TUNIT____-NEXT:    ret ptr undef
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
; IS__CGSCC____-LABEL: define {{[^@]+}}@foo.4
; IS__CGSCC____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC____-NEXT:    store ptr [[__FIRST]], ptr [[__FIRST]], align 8
; IS__CGSCC____-NEXT:    [[CALL1:%.*]] = call noalias noundef nonnull align 8 dereferenceable(8) ptr @bar(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[__FIRST]]) #[[ATTR7:[0-9]+]]
; IS__CGSCC____-NEXT:    ret ptr [[CALL1]]
;
entry:
  %__first.addr = alloca ptr, i32 0, align 8
  store ptr %__first, ptr %__first, align 8
  %0 = load ptr, ptr %__first, align 8
  %call1 = call ptr @bar(ptr %__first)
  ret ptr %call1
}

define internal ptr @bar(ptr %QQfirst) {
; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@bar
; IS__CGSCC____-SAME: (ptr noalias nofree noundef nonnull readnone returned align 8 dereferenceable(8) "no-capture-maybe-returned" [[QQFIRST:%.*]]) #[[ATTR1:[0-9]+]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    [[QQFIRST_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC____-NEXT:    store ptr [[QQFIRST]], ptr [[QQFIRST_ADDR]], align 8
; IS__CGSCC____-NEXT:    br label [[WHILE_COND:%.*]]
; IS__CGSCC____:       while.cond:
; IS__CGSCC____-NEXT:    br label [[WHILE_END:%.*]]
; IS__CGSCC____:       while.end:
; IS__CGSCC____-NEXT:    ret ptr [[QQFIRST]]
;
entry:
  %QQfirst.addr = alloca ptr, i32 0, align 8
  store ptr %QQfirst, ptr %QQfirst.addr, align 8
  br label %while.cond

while.cond:                                       ; preds = %entry
  br label %while.end

while.end:                                        ; preds = %while.cond
  %0 = load ptr, ptr %QQfirst.addr, align 8
  ret ptr %0
}

define ptr @t2(ptr %this, ptr %this.addr, ptr %this1) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT____-LABEL: define {{[^@]+}}@t2
; IS__TUNIT____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR1:[0-9]+]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @foo.1(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4:[0-9]+]]
; IS__TUNIT____-NEXT:    [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
; IS__TUNIT____-NEXT:    ret ptr [[TEST_RET]]
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@t2
; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2:[0-9]+]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @foo.1(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8:[0-9]+]]
; IS__CGSCC____-NEXT:    [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
; IS__CGSCC____-NEXT:    ret ptr [[TEST_RET]]
;
entry:
  store ptr %this, ptr %this, align 8
  %this12 = load ptr, ptr %this, align 8
  %call = call %S @foo.1(ptr %this)
  %test.ret = extractvalue %S %call, 0
  ret ptr %test.ret
}

define internal %S @foo.1(ptr %foo.this) {
; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@foo.1
; IS__TUNIT_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR1]] {
; IS__TUNIT_OPM-NEXT:  entry:
; IS__TUNIT_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__TUNIT_OPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
; IS__TUNIT_OPM-NEXT:    call void @bar.2(ptr nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR5:[0-9]+]]
; IS__TUNIT_OPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__TUNIT_OPM-NEXT:    ret [[S]] [[FOO_RET]]
;
; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@foo.1
; IS__TUNIT_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR1]] {
; IS__TUNIT_NPM-NEXT:  entry:
; IS__TUNIT_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__TUNIT_NPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
; IS__TUNIT_NPM-NEXT:    call void @bar.2(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR5:[0-9]+]]
; IS__TUNIT_NPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__TUNIT_NPM-NEXT:    ret [[S]] [[FOO_RET]]
;
; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@foo.1
; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR2]] {
; IS__CGSCC_OPM-NEXT:  entry:
; IS__CGSCC_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__CGSCC_OPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
; IS__CGSCC_OPM-NEXT:    call void @bar.2(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR6]]
; IS__CGSCC_OPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__CGSCC_OPM-NEXT:    ret [[S]] [[FOO_RET]]
;
; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@foo.1
; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR2]] {
; IS__CGSCC_NPM-NEXT:  entry:
; IS__CGSCC_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__CGSCC_NPM-NEXT:    store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8
; IS__CGSCC_NPM-NEXT:    call void @bar.2(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR6]]
; IS__CGSCC_NPM-NEXT:    [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__CGSCC_NPM-NEXT:    ret [[S]] [[FOO_RET]]
;
entry:
  %retval = alloca %S, i32 0, align 8
  store ptr %foo.this, ptr %foo.this, align 8
  call void @bar.2(ptr %retval, ptr %foo.this)
  %foo.ret = load %S, ptr %retval, align 8
  ret %S %foo.ret
}

define internal void @bar.2(ptr %bar.this, ptr %bar.data) {
; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@bar.2
; IS__TUNIT_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
; IS__TUNIT_OPM-NEXT:  entry:
; IS__TUNIT_OPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
; IS__TUNIT_OPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR5]]
; IS__TUNIT_OPM-NEXT:    ret void
;
; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@bar.2
; IS__TUNIT_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
; IS__TUNIT_NPM-NEXT:  entry:
; IS__TUNIT_NPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
; IS__TUNIT_NPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR5]]
; IS__TUNIT_NPM-NEXT:    ret void
;
; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@bar.2
; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
; IS__CGSCC_OPM-NEXT:  entry:
; IS__CGSCC_OPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
; IS__CGSCC_OPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR6]]
; IS__CGSCC_OPM-NEXT:    ret void
;
; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@bar.2
; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {
; IS__CGSCC_NPM-NEXT:  entry:
; IS__CGSCC_NPM-NEXT:    store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8
; IS__CGSCC_NPM-NEXT:    call void @baz(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR6]]
; IS__CGSCC_NPM-NEXT:    ret void
;
entry:
  store ptr %bar.data, ptr %bar.this, align 8
  call void @baz(ptr %bar.this, ptr %bar.data)
  ret void
}

define internal void @baz(ptr %baz.this, ptr %baz.data) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT____-LABEL: define {{[^@]+}}@baz
; IS__TUNIT____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_DATA:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8
; IS__TUNIT____-NEXT:    ret void
;
; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__CGSCC____-LABEL: define {{[^@]+}}@baz
; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree writeonly [[BAZ_DATA:%.*]]) #[[ATTR3:[0-9]+]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8
; IS__CGSCC____-NEXT:    ret void
;
entry:
  store ptr %baz.data, ptr %baz.this, align 8
  ret void
}

define ptr @foo(ptr %this, ptr %this.addr, ptr %this1) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT____-LABEL: define {{[^@]+}}@foo
; IS__TUNIT____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR1]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @bar.5(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]
; IS__TUNIT____-NEXT:    [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
; IS__TUNIT____-NEXT:    ret ptr [[FOO_RET]]
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@foo
; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @bar.5(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
; IS__CGSCC____-NEXT:    [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0
; IS__CGSCC____-NEXT:    ret ptr [[FOO_RET]]
;
entry:
  store ptr %this, ptr %this, align 8
  %this12 = load ptr, ptr %this, align 8
  %call = call %S @bar.5(ptr %this)
  %foo.ret = extractvalue %S %call, 0
  ret ptr %foo.ret
}

define internal %S @bar.5(ptr %this) {
; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@bar.5
; IS__TUNIT_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR1]] {
; IS__TUNIT_OPM-NEXT:  entry:
; IS__TUNIT_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__TUNIT_OPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__TUNIT_OPM-NEXT:    call void @baz.6(ptr nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]
; IS__TUNIT_OPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__TUNIT_OPM-NEXT:    ret [[S]] [[BAR_RET]]
;
; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@bar.5
; IS__TUNIT_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR1]] {
; IS__TUNIT_NPM-NEXT:  entry:
; IS__TUNIT_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__TUNIT_NPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__TUNIT_NPM-NEXT:    call void @baz.6(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]
; IS__TUNIT_NPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__TUNIT_NPM-NEXT:    ret [[S]] [[BAR_RET]]
;
; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@bar.5
; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
; IS__CGSCC_OPM-NEXT:  entry:
; IS__CGSCC_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__CGSCC_OPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__CGSCC_OPM-NEXT:    call void @baz.6(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
; IS__CGSCC_OPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__CGSCC_OPM-NEXT:    ret [[S]] [[BAR_RET]]
;
; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@bar.5
; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
; IS__CGSCC_NPM-NEXT:  entry:
; IS__CGSCC_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__CGSCC_NPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__CGSCC_NPM-NEXT:    call void @baz.6(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
; IS__CGSCC_NPM-NEXT:    [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__CGSCC_NPM-NEXT:    ret [[S]] [[BAR_RET]]
;
entry:
  %retval = alloca %S, i32 0, align 8
  store ptr %this, ptr %this, align 8
  %0 = load ptr, ptr %this, align 8
  call void @baz.6(ptr %retval, ptr %this)
  %bar.ret = load %S, ptr %retval, align 8
  ret %S %bar.ret
}

define internal void @baz.6(ptr %this, ptr %data) {
; IS__TUNIT_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@baz.6
; IS__TUNIT_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {
; IS__TUNIT_OPM-NEXT:  entry:
; IS__TUNIT_OPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__TUNIT_OPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR4]]
; IS__TUNIT_OPM-NEXT:    ret void
;
; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@baz.6
; IS__TUNIT_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {
; IS__TUNIT_NPM-NEXT:  entry:
; IS__TUNIT_NPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__TUNIT_NPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR4]]
; IS__TUNIT_NPM-NEXT:    ret void
;
; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@baz.6
; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR2]] {
; IS__CGSCC_OPM-NEXT:  entry:
; IS__CGSCC_OPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__CGSCC_OPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR8]]
; IS__CGSCC_OPM-NEXT:    ret void
;
; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@baz.6
; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR2]] {
; IS__CGSCC_NPM-NEXT:  entry:
; IS__CGSCC_NPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__CGSCC_NPM-NEXT:    call void @boom(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR8]]
; IS__CGSCC_NPM-NEXT:    ret void
;
entry:
  store ptr %data, ptr %this, align 8
  call void @boom(ptr %this, ptr %data)
  ret void
}

define internal void @boom(ptr %this, ptr %data) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__TUNIT____-LABEL: define {{[^@]+}}@boom
; IS__TUNIT____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    store ptr [[DATA]], ptr [[DATA_ADDR]], align 8
; IS__TUNIT____-NEXT:    [[V:%.*]] = load ptr, ptr [[DATA_ADDR]], align 8
; IS__TUNIT____-NEXT:    store ptr [[V]], ptr [[THIS]], align 8
; IS__TUNIT____-NEXT:    ret void
;
; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@boom
; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree [[DATA:%.*]]) #[[ATTR4:[0-9]+]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[DATA_ADDR]], align 8
; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__CGSCC____-NEXT:    ret void
;
entry:
  %data.addr = alloca ptr, i32 0, align 8
  store ptr %data, ptr %data.addr, align 8
  %v = load ptr, ptr %data.addr, align 8
  store ptr %v, ptr %this, align 8
  ret void
}

define weak_odr void @t3() {
; CHECK-LABEL: define {{[^@]+}}@t3() {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr noalias nocapture noundef align 4294967296 null, i8 noundef 0, i1 noundef false, i1 noundef false)
; CHECK-NEXT:    br label [[USER_CODE_ENTRY:%.*]]
; CHECK:       user_code.entry:
; CHECK-NEXT:    br label [[FOR_COND:%.*]]
; CHECK:       for.cond:
; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
; CHECK:       for.body:
; CHECK-NEXT:    [[CALL4:%.*]] = call [[S_2:%.*]] @t3.helper()
; CHECK-NEXT:    ret void
;
entry:
  %0 = call i32 @__kmpc_target_init(ptr null, i8 0, i1 false, i1 false)
  br label %user_code.entry

user_code.entry:                                  ; preds = %entry
  br label %for.cond

for.cond:                                         ; preds = %user_code.entry
  br label %for.body

for.body:                                         ; preds = %for.cond
  %call4 = call %S.2 @t3.helper()
  ret void
}

declare i32 @__kmpc_target_init(ptr, i8, i1, i1)

define %S.2 @t3.helper() {
; CHECK-LABEL: define {{[^@]+}}@t3.helper() {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[RETVAL:%.*]] = alloca [[S_2:%.*]], align 8
; CHECK-NEXT:    call void @ext1(ptr noundef nonnull align 8 dereferenceable(24) [[RETVAL]])
; CHECK-NEXT:    [[DOTFCA_0_LOAD:%.*]] = load ptr, ptr [[RETVAL]], align 8
; CHECK-NEXT:    [[DOTFCA_0_INSERT:%.*]] = insertvalue [[S_2]] poison, ptr [[DOTFCA_0_LOAD]], 0
; CHECK-NEXT:    [[DOTFCA_1_GEP:%.*]] = getelementptr inbounds [[S_2]], ptr [[RETVAL]], i32 0, i32 1
; CHECK-NEXT:    [[DOTFCA_1_LOAD:%.*]] = load i64, ptr [[DOTFCA_1_GEP]], align 8
; CHECK-NEXT:    [[DOTFCA_1_INSERT:%.*]] = insertvalue [[S_2]] [[DOTFCA_0_INSERT]], i64 [[DOTFCA_1_LOAD]], 1
; CHECK-NEXT:    [[DOTFCA_2_GEP:%.*]] = getelementptr inbounds [[S_2]], ptr [[RETVAL]], i32 0, i32 2
; CHECK-NEXT:    [[DOTFCA_2_LOAD:%.*]] = load i64, ptr [[DOTFCA_2_GEP]], align 8
; CHECK-NEXT:    [[DOTFCA_2_INSERT:%.*]] = insertvalue [[S_2]] [[DOTFCA_1_INSERT]], i64 [[DOTFCA_2_LOAD]], 2
; CHECK-NEXT:    ret [[S_2]] zeroinitializer
;
entry:
  %retval = alloca %S.2, align 8
  call void @ext1(ptr %retval)
  %.fca.0.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 0
  %.fca.0.load = load ptr, ptr %.fca.0.gep, align 8
  %.fca.0.insert = insertvalue %S.2 poison, ptr %.fca.0.load, 0
  %.fca.1.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 1
  %.fca.1.load = load i64, ptr %.fca.1.gep, align 8
  %.fca.1.insert = insertvalue %S.2 %.fca.0.insert, i64 %.fca.1.load, 1
  %.fca.2.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 2
  %.fca.2.load = load i64, ptr %.fca.2.gep, align 8
  %.fca.2.insert = insertvalue %S.2 %.fca.1.insert, i64 %.fca.2.load, 2
  ret %S.2 zeroinitializer
}

declare void @ext1(ptr)

; Taken from https://github.com/llvm/llvm-project/issues/54981
define dso_local void @spam() {
; IS__TUNIT_OPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@spam
; IS__TUNIT_OPM-SAME: () #[[ATTR2:[0-9]+]] {
; IS__TUNIT_OPM-NEXT:  bb:
; IS__TUNIT_OPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
; IS__TUNIT_OPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
; IS__TUNIT_OPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
; IS__TUNIT_OPM-NEXT:    br label [[BB16:%.*]]
; IS__TUNIT_OPM:       bb16:
; IS__TUNIT_OPM-NEXT:    [[TMP17:%.*]] = load i32, ptr [[TMP]], align 4
; IS__TUNIT_OPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[TMP17]], 0
; IS__TUNIT_OPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
; IS__TUNIT_OPM:       bb19:
; IS__TUNIT_OPM-NEXT:    [[Y:%.*]] = getelementptr inbounds i32, ptr [[TMP]], i64 0
; IS__TUNIT_OPM-NEXT:    [[TMP20:%.*]] = bitcast ptr [[Y]] to ptr
; IS__TUNIT_OPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP20]], align 4
; IS__TUNIT_OPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
; IS__TUNIT_OPM-NEXT:    br label [[BB23:%.*]]
; IS__TUNIT_OPM:       bb23:
; IS__TUNIT_OPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
; IS__TUNIT_OPM-NEXT:    br label [[BB25:%.*]]
; IS__TUNIT_OPM:       bb25:
; IS__TUNIT_OPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
; IS__TUNIT_OPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
; IS__TUNIT_OPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
; IS__TUNIT_OPM:       bb28:
; IS__TUNIT_OPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
; IS__TUNIT_OPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
; IS__TUNIT_OPM-NEXT:    br label [[BB25]]
; IS__TUNIT_OPM:       bb34:
; IS__TUNIT_OPM-NEXT:    br label [[BB23]]
; IS__TUNIT_OPM:       bb35:
; IS__TUNIT_OPM-NEXT:    unreachable
;
; IS__TUNIT_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@spam
; IS__TUNIT_NPM-SAME: () #[[ATTR2:[0-9]+]] {
; IS__TUNIT_NPM-NEXT:  bb:
; IS__TUNIT_NPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
; IS__TUNIT_NPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
; IS__TUNIT_NPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
; IS__TUNIT_NPM-NEXT:    br label [[BB16:%.*]]
; IS__TUNIT_NPM:       bb16:
; IS__TUNIT_NPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[X]], 0
; IS__TUNIT_NPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
; IS__TUNIT_NPM:       bb19:
; IS__TUNIT_NPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP]], align 4
; IS__TUNIT_NPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
; IS__TUNIT_NPM-NEXT:    br label [[BB23:%.*]]
; IS__TUNIT_NPM:       bb23:
; IS__TUNIT_NPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
; IS__TUNIT_NPM-NEXT:    br label [[BB25:%.*]]
; IS__TUNIT_NPM:       bb25:
; IS__TUNIT_NPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
; IS__TUNIT_NPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
; IS__TUNIT_NPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
; IS__TUNIT_NPM:       bb28:
; IS__TUNIT_NPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
; IS__TUNIT_NPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
; IS__TUNIT_NPM-NEXT:    br label [[BB25]]
; IS__TUNIT_NPM:       bb34:
; IS__TUNIT_NPM-NEXT:    br label [[BB23]]
; IS__TUNIT_NPM:       bb35:
; IS__TUNIT_NPM-NEXT:    unreachable
;
; IS__CGSCC_OPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@spam
; IS__CGSCC_OPM-SAME: () #[[ATTR5:[0-9]+]] {
; IS__CGSCC_OPM-NEXT:  bb:
; IS__CGSCC_OPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
; IS__CGSCC_OPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
; IS__CGSCC_OPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
; IS__CGSCC_OPM-NEXT:    br label [[BB16:%.*]]
; IS__CGSCC_OPM:       bb16:
; IS__CGSCC_OPM-NEXT:    [[TMP17:%.*]] = load i32, ptr [[TMP]], align 4
; IS__CGSCC_OPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[TMP17]], 0
; IS__CGSCC_OPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
; IS__CGSCC_OPM:       bb19:
; IS__CGSCC_OPM-NEXT:    [[Y:%.*]] = getelementptr inbounds i32, ptr [[TMP]], i64 0
; IS__CGSCC_OPM-NEXT:    [[TMP20:%.*]] = bitcast ptr [[Y]] to ptr
; IS__CGSCC_OPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP20]], align 4
; IS__CGSCC_OPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
; IS__CGSCC_OPM-NEXT:    br label [[BB23:%.*]]
; IS__CGSCC_OPM:       bb23:
; IS__CGSCC_OPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
; IS__CGSCC_OPM-NEXT:    br label [[BB25:%.*]]
; IS__CGSCC_OPM:       bb25:
; IS__CGSCC_OPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
; IS__CGSCC_OPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
; IS__CGSCC_OPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
; IS__CGSCC_OPM:       bb28:
; IS__CGSCC_OPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
; IS__CGSCC_OPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
; IS__CGSCC_OPM-NEXT:    br label [[BB25]]
; IS__CGSCC_OPM:       bb34:
; IS__CGSCC_OPM-NEXT:    br label [[BB23]]
; IS__CGSCC_OPM:       bb35:
; IS__CGSCC_OPM-NEXT:    unreachable
;
; IS__CGSCC_NPM: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@spam
; IS__CGSCC_NPM-SAME: () #[[ATTR5:[0-9]+]] {
; IS__CGSCC_NPM-NEXT:  bb:
; IS__CGSCC_NPM-NEXT:    [[TMP:%.*]] = alloca i32, align 4
; IS__CGSCC_NPM-NEXT:    [[X:%.*]] = fptosi float undef to i32
; IS__CGSCC_NPM-NEXT:    store i32 [[X]], ptr [[TMP]], align 4
; IS__CGSCC_NPM-NEXT:    br label [[BB16:%.*]]
; IS__CGSCC_NPM:       bb16:
; IS__CGSCC_NPM-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[X]], 0
; IS__CGSCC_NPM-NEXT:    br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]
; IS__CGSCC_NPM:       bb19:
; IS__CGSCC_NPM-NEXT:    [[TMP21:%.*]] = load float, ptr [[TMP]], align 4
; IS__CGSCC_NPM-NEXT:    [[TMP22:%.*]] = fadd fast float [[TMP21]], 0.000000e+00
; IS__CGSCC_NPM-NEXT:    br label [[BB23:%.*]]
; IS__CGSCC_NPM:       bb23:
; IS__CGSCC_NPM-NEXT:    [[TMP24:%.*]] = phi <2 x float> [ undef, [[BB19]] ], [ [[TMP26:%.*]], [[BB34:%.*]] ]
; IS__CGSCC_NPM-NEXT:    br label [[BB25:%.*]]
; IS__CGSCC_NPM:       bb25:
; IS__CGSCC_NPM-NEXT:    [[TMP26]] = phi <2 x float> [ [[TMP30:%.*]], [[BB28:%.*]] ], [ [[TMP24]], [[BB23]] ]
; IS__CGSCC_NPM-NEXT:    [[TMP27:%.*]] = icmp ult i32 undef, 8
; IS__CGSCC_NPM-NEXT:    br i1 [[TMP27]], label [[BB28]], label [[BB34]]
; IS__CGSCC_NPM:       bb28:
; IS__CGSCC_NPM-NEXT:    [[TMP29:%.*]] = insertelement <2 x float> [[TMP26]], float undef, i32 0
; IS__CGSCC_NPM-NEXT:    [[TMP30]] = insertelement <2 x float> [[TMP29]], float [[TMP22]], i32 1
; IS__CGSCC_NPM-NEXT:    br label [[BB25]]
; IS__CGSCC_NPM:       bb34:
; IS__CGSCC_NPM-NEXT:    br label [[BB23]]
; IS__CGSCC_NPM:       bb35:
; IS__CGSCC_NPM-NEXT:    unreachable
;
bb:
  %tmp = alloca i32, align 4
  %tmp12 = getelementptr inbounds i32, ptr %tmp, i64 0
  %tmp15 = getelementptr inbounds i32, ptr %tmp, i64 0
  %x = fptosi float undef to i32
  store i32 %x, ptr %tmp15, align 4
  br label %bb16

bb16:                                             ; preds = %bb
  %tmp17 = load i32, ptr %tmp12, align 4
  %tmp18 = icmp eq i32 %tmp17, 0
  br i1 %tmp18, label %bb35, label %bb19

bb19:                                             ; preds = %bb16
  %y = getelementptr inbounds i32, ptr %tmp, i64 0
  %tmp20 = bitcast ptr %y to ptr
  %tmp21 = load float, ptr %tmp20, align 4
  %tmp22 = fadd fast float %tmp21, 0.000000e+00
  br label %bb23

bb23:                                             ; preds = %bb34, %bb19
  %tmp24 = phi <2 x float> [ undef, %bb19 ], [ %tmp26, %bb34 ]
  br label %bb25

bb25:                                             ; preds = %bb28, %bb23
  %tmp26 = phi <2 x float> [ %tmp30, %bb28 ], [ %tmp24, %bb23 ]
  %tmp27 = icmp ult i32 undef, 8
  br i1 %tmp27, label %bb28, label %bb34

bb28:                                             ; preds = %bb25
  %tmp29 = insertelement <2 x float> %tmp26, float undef, i32 0
  %tmp30 = insertelement <2 x float> %tmp29, float %tmp22, i32 1
  br label %bb25

bb34:                                             ; preds = %bb25
  br label %bb23

bb35:                                             ; preds = %bb16
  unreachable
}

define double @t4(ptr %this, ptr %this.addr, ptr %this1) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT____-LABEL: define {{[^@]+}}@t4
; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__TUNIT____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @t4a(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR5:[0-9]+]]
; IS__TUNIT____-NEXT:    ret double 0.000000e+00
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@t4
; IS__CGSCC____-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nocapture nofree readnone [[THIS_ADDR:%.*]], ptr nocapture nofree readnone [[THIS1:%.*]]) #[[ATTR2]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__CGSCC____-NEXT:    [[CALL:%.*]] = call [[S:%.*]] @t4a(ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]
; IS__CGSCC____-NEXT:    [[TMP0:%.*]] = extractvalue [[S]] [[CALL]], 0
; IS__CGSCC____-NEXT:    ret double 0.000000e+00
;
entry:
  %this.addr1 = alloca ptr, i32 0, align 8
  store ptr %this, ptr %this, align 8
  %this12 = load ptr, ptr %this, align 8
  %call = call %S @t4a(ptr %this)
  %0 = extractvalue %S %call, 0
  ret double 0.000000e+00
}

define internal %S @t4a(ptr %this) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT____-LABEL: define {{[^@]+}}@t4a
; IS__TUNIT____-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__TUNIT____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__TUNIT____-NEXT:    call void @t4b(ptr noalias nocapture nofree noundef nonnull writeonly align 8 [[RETVAL]]) #[[ATTR5]]
; IS__TUNIT____-NEXT:    ret [[S]] undef
;
; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t4a
; IS__CGSCC_OPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
; IS__CGSCC_OPM-NEXT:  entry:
; IS__CGSCC_OPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__CGSCC_OPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC_OPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__CGSCC_OPM-NEXT:    call void @t4b(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR6]]
; IS__CGSCC_OPM-NEXT:    [[TMP0:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__CGSCC_OPM-NEXT:    ret [[S]] [[TMP0]]
;
; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@t4a
; IS__CGSCC_NPM-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {
; IS__CGSCC_NPM-NEXT:  entry:
; IS__CGSCC_NPM-NEXT:    [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8
; IS__CGSCC_NPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC_NPM-NEXT:    store ptr [[THIS]], ptr [[THIS]], align 8
; IS__CGSCC_NPM-NEXT:    call void @t4b(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR6]]
; IS__CGSCC_NPM-NEXT:    [[TMP0:%.*]] = load [[S]], ptr [[RETVAL]], align 8
; IS__CGSCC_NPM-NEXT:    ret [[S]] [[TMP0]]
;
entry:
  %retval = alloca %S, i32 0, align 8
  %this.addr = alloca ptr, i32 0, align 8
  store ptr %this, ptr %this, align 8
  %this1 = load ptr, ptr %this, align 8
  %buffer_ = getelementptr inbounds %struct1, ptr %this1, i32 0, i32 0
  %data_ = getelementptr inbounds %struct2, ptr %buffer_, i32 0, i32 0
  %0 = load ptr, ptr %this, align 8
  call void @t4b(ptr %retval, ptr %this)
  %1 = load %S, ptr %retval, align 8
  ret %S %1
}

define internal void @t4b(ptr %this, ptr %data) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT____-LABEL: define {{[^@]+}}@t4b
; IS__TUNIT____-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    call void @t4c(ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR5]]
; IS__TUNIT____-NEXT:    ret void
;
; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t4b
; IS__CGSCC_OPM-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR0]] {
; IS__CGSCC_OPM-NEXT:  entry:
; IS__CGSCC_OPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC_OPM-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC_OPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__CGSCC_OPM-NEXT:    call void @t4c(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA]]) #[[ATTR6]]
; IS__CGSCC_OPM-NEXT:    ret void
;
; IS__CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@t4b
; IS__CGSCC_NPM-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR0]] {
; IS__CGSCC_NPM-NEXT:  entry:
; IS__CGSCC_NPM-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC_NPM-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC_NPM-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__CGSCC_NPM-NEXT:    call void @t4c(ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA]]) #[[ATTR6]]
; IS__CGSCC_NPM-NEXT:    ret void
;
entry:
  %this.addr = alloca ptr, i32 0, align 8
  %data.addr = alloca ptr, i32 0, align 8
  store ptr %this, ptr %this.addr, align 8
  store ptr %data, ptr %this, align 8
  %this1 = load ptr, ptr %this, align 8
  %0 = load ptr, ptr %this, align 8
  call void @t4c(ptr %this, ptr %data)
  ret void
}

define internal void @t4c(ptr %this, ptr %data) {
; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT____-LABEL: define {{[^@]+}}@t4c
; IS__TUNIT____-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT:  entry:
; IS__TUNIT____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__TUNIT____-NEXT:    ret void
;
; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__CGSCC____-LABEL: define {{[^@]+}}@t4c
; IS__CGSCC____-SAME: (ptr nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree writeonly [[DATA:%.*]]) #[[ATTR3]] {
; IS__CGSCC____-NEXT:  entry:
; IS__CGSCC____-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC____-NEXT:    [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8
; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__CGSCC____-NEXT:    store ptr [[DATA]], ptr [[THIS]], align 8
; IS__CGSCC____-NEXT:    ret void
;
entry:
  %this.addr = alloca ptr, i32 0, align 8
  %data.addr = alloca ptr, i32 0, align 8
  store ptr %this, ptr %this.addr, align 8
  store ptr %data, ptr %this, align 8
  %this1 = load ptr, ptr %this, align 8
  %data_ = getelementptr inbounds %S, ptr %this1, i32 0, i32 0
  %0 = load ptr, ptr %this, align 8
  store ptr %data, ptr %this, align 8
  ret void
}

!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7}

!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 7, !"openmp", i32 50}
!3 = !{i32 7, !"openmp-device", i32 50}
!4 = !{i32 7, !"PIC Level", i32 2}
!5 = !{i32 7, !"frame-pointer", i32 2}
!6 = !{i32 7, !"Dwarf Version", i32 2}
!7 = !{i32 2, !"Debug Info Version", i32 3}
;.
; IS__TUNIT____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
; IS__TUNIT____: attributes #[[ATTR1]] = { argmemonly nofree norecurse nosync nounwind willreturn }
; IS__TUNIT____: attributes #[[ATTR2:[0-9]+]] = { nofree norecurse noreturn nosync nounwind readnone }
; IS__TUNIT____: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn writeonly }
; IS__TUNIT____: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn }
; IS__TUNIT____: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn writeonly }
;.
; IS__CGSCC____: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind willreturn writeonly }
; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
; IS__CGSCC____: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind willreturn }
; IS__CGSCC____: attributes #[[ATTR3]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
; IS__CGSCC____: attributes #[[ATTR4]] = { argmemonly nofree norecurse nosync nounwind willreturn }
; IS__CGSCC____: attributes #[[ATTR5:[0-9]+]] = { nofree norecurse noreturn nosync nounwind readnone }
; IS__CGSCC____: attributes #[[ATTR6]] = { nounwind willreturn writeonly }
; IS__CGSCC____: attributes #[[ATTR7]] = { readnone willreturn }
; IS__CGSCC____: attributes #[[ATTR8]] = { nounwind willreturn }
;.
; CHECK: [[META0:![0-9]+]] = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]}
; CHECK: [[META1:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
; CHECK: [[META2:![0-9]+]] = !{i32 7, !"openmp", i32 50}
; CHECK: [[META3:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}
; CHECK: [[META4:![0-9]+]] = !{i32 7, !"PIC Level", i32 2}
; CHECK: [[META5:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}
; CHECK: [[META6:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 2}
; CHECK: [[META7:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
;.