================
@@ -0,0 +1,28 @@
+!===----------------------------------------------------------------------===!
+! This directory can be used to add Integration tests involving multiple
+! stages of the compiler (for eg. from Fortran to LLVM IR). It should not
+! contain executable tests. We should only add tests here sparingly and only
+! if there is no other way to test. Repeat this message in each test that is
+! added to this directory and sub-directories.
+!===----------------------------------------------------------------------===!
+
+! nonlazybind and the RtLibUseGOT module flag are applied to the LLVM module
+! after FIR is translated, so -emit-hlfir and -emit-fir cannot observe them.
+! -fno-plt marks an external procedure nonlazybind and requests GOT for
+! compiler-rt. A procedure defined in this file is left unchanged. The
+! default, and -fplt after -fno-plt, do neither.
+
+! RUN: %flang_fc1 -emit-llvm -fno-plt -o - %s | FileCheck %s
--check-prefix=NOPLT
+! RUN: %flang_fc1 -emit-llvm -o - %s | FileCheck %s --check-prefix=PLT
+! RUN: %flang_fc1 -emit-llvm -fno-plt -fplt -o - %s | FileCheck %s
--check-prefix=PLT
+
+subroutine test
+ call ext
+end subroutine
+
+! NOPLT: define void @test_()
+! NOPLT: declare void @ext_() #[[ATTR:[0-9]+]]
+! NOPLT: attributes #[[ATTR]] = { nonlazybind }
+! NOPLT: !"RtLibUseGOT"
----------------
eugeneepshteyn wrote:
(This comment was generated with the help of AI)
The comment above says a procedure defined in this file is left unchanged, but
`define void @test_()` is a prefix match: output in which `@test_` also carries
`nonlazybind` still passes. The test also has no runtime call and no intrinsic,
the other two kinds of declaration the loop has to tell apart. Without changing
the RUN lines, something like this covers all three:
```fortran
subroutine test(x)
real :: x
call ext
x = sin(x)
print *, x
end subroutine
! NOPLT: define void @test_({{.*}}) {
! NOPLT: declare void @ext_() #[[ATTR:[0-9]+]]
! NOPLT: declare ptr @_FortranAioBeginExternalListOutput({{.*}}) #[[ATTR]]
! NOPLT: declare float @llvm.sin.f32(float) #[[INTR:[0-9]+]]
! NOPLT: attributes #[[ATTR]] = { nonlazybind }
! NOPLT-NOT: attributes #[[INTR]] = {{.*}}nonlazybind
! NOPLT: !"RtLibUseGOT"
! PLT-NOT: nonlazybind
! PLT-NOT: RtLibUseGOT
```
https://github.com/llvm/llvm-project/pull/235622
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits