brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 9d341ab Raw
28 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -fextend-variable-liveness -o - %s | FileCheck %s2 3/// Tests that when we have fake uses in a function ending in a musttail call,4/// we emit the fake uses and their corresponding loads immediately prior to the5/// tail call.6 7extern "C" char *bar(int *);8 9// CHECK-LABEL: define dso_local ptr @foo(10// CHECK-SAME:    ptr noundef [[E:%.*]])11// CHECK-NEXT:  [[ENTRY:.*:]]12// CHECK-NEXT:    [[E_ADDR:%.*]] = alloca ptr, align 813// CHECK-NEXT:    store ptr [[E]], ptr [[E_ADDR]], align 814// CHECK-NEXT:    [[TMP0:%.*]] = load ptr, ptr [[E_ADDR]], align 815// CHECK-NEXT:    [[FAKE_USE:%.*]] = load ptr, ptr [[E_ADDR]]16// CHECK-NEXT:    notail call void (...) @llvm.fake.use(ptr [[FAKE_USE]])17// CHECK-NEXT:    [[CALL:%.*]] = musttail call ptr @bar(ptr noundef [[TMP0]])18// CHECK-NEXT:    ret ptr [[CALL]]19 20// CHECK:       [[BB1:.*:]]21// CHECK-NEXT:    [[FAKE_USE1:%.*]] = load ptr, ptr [[E_ADDR]]22// CHECK-NEXT:    notail call void (...) @llvm.fake.use(ptr [[FAKE_USE1]])23// CHECK-NEXT:    ret ptr undef24//25extern "C" const char *foo(int *e) {26  [[clang::musttail]] return bar(e);27}28