File _service:tar_scm:0017-Add-the-support-for-classic-flang.patch of Package llvm (Revision 72f0ca0be905fca232aced496e76742b)

Currently displaying revision 72f0ca0be905fca232aced496e76742b , Show latest

1777
 
1
From b297f30783da0dfb3098fe6d39b209caacd45691 Mon Sep 17 00:00:00 2001
2
From: luofeng14 <luofeng13@huawei.com>
3
Date: Fri, 1 Mar 2024 18:39:52 +0800
4
Subject: [PATCH] sync classic flang patch
5
6
---
7
 llvm/cmake/modules/HandleLLVMOptions.cmake    |   8 +
8
 llvm/include/llvm-c/DebugInfo.h               |   5 +-
9
 .../include/llvm/Analysis/TargetLibraryInfo.h |   6 +-
10
 llvm/include/llvm/Analysis/VecFuncs.def       | 592 ++++++++++++++++++
11
 llvm/include/llvm/IR/DIBuilder.h              |  28 +-
12
 llvm/include/llvm/IR/DebugInfoMetadata.h      |  32 +-
13
 llvm/lib/Analysis/TargetLibraryInfo.cpp       |  38 +-
14
 llvm/lib/AsmParser/LLParser.cpp               |  22 +-
15
 llvm/lib/Bitcode/Reader/MetadataLoader.cpp    |  42 +-
16
 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp     |   3 +-
17
 llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h   |  54 ++
18
 .../lib/CodeGen/AsmPrinter/DebugLocStream.cpp |   5 +
19
 llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h  |   6 +
20
 .../CodeGen/AsmPrinter/DwarfCompileUnit.cpp   |   3 +
21
 llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h      |   4 +
22
 llvm/lib/IR/AsmWriter.cpp                     |   1 +
23
 llvm/lib/IR/DIBuilder.cpp                     |  12 +-
24
 llvm/lib/IR/DebugInfo.cpp                     |  10 +-
25
 llvm/lib/IR/DebugInfoMetadata.cpp             |  12 +-
26
 llvm/lib/IR/LLVMContextImpl.h                 |  11 +-
27
 .../Instrumentation/InstrProfiling.cpp        |   4 +-
28
 .../invalid-diglobalvariable-empty-name.ll    |   1 +
29
 .../Generic/fortran-subprogram-at.ll          |  24 +
30
 .../DebugInfo/Generic/more-subprogram-attr.ll |  38 ++
31
 llvm/test/DebugInfo/X86/DICommonBlock.ll      |  36 ++
32
 llvm/test/lit.cfg.py                          |   3 +
33
 llvm/test/lit.site.cfg.py.in                  |   1 +
34
 llvm/tools/llvm-c-test/debuginfo.c            |   4 +-
35
 llvm/unittests/IR/MetadataTest.cpp            |  47 +-
36
 llvm/utils/lit/lit/TestingConfig.py           |   1 +
37
 llvm/utils/lit/lit/llvm/config.py             |  10 +
38
 31 files changed, 983 insertions(+), 80 deletions(-)
39
 create mode 100644 llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll
40
 create mode 100644 llvm/test/DebugInfo/Generic/more-subprogram-attr.ll
41
 create mode 100644 llvm/test/DebugInfo/X86/DICommonBlock.ll
42
43
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
44
index 76723be696e5..492ea25b179b 100644
45
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
46
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
47
@@ -89,6 +89,14 @@ if( LLVM_ENABLE_ASSERTIONS )
48
   add_compile_definitions(_LIBCPP_ENABLE_HARDENED_MODE)
49
 endif()
50
 
51
+option(LLVM_ENABLE_CLASSIC_FLANG "Build support for classic Flang instead of the new built-in Flang" OFF)
52
+if(LLVM_ENABLE_CLASSIC_FLANG)
53
+  set(LLVM_ENABLE_CLASSIC_FLANG 1)
54
+  add_definitions( -DENABLE_CLASSIC_FLANG )
55
+else()
56
+  set(LLVM_ENABLE_CLASSIC_FLANG 0)
57
+endif()
58
+
59
 if(LLVM_ENABLE_EXPENSIVE_CHECKS)
60
   add_compile_definitions(EXPENSIVE_CHECKS)
61
 
62
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
63
index 5924294708cc..09d584c24711 100644
64
--- a/llvm/include/llvm-c/DebugInfo.h
65
+++ b/llvm/include/llvm-c/DebugInfo.h
66
@@ -1148,7 +1148,8 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(
67
     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
68
     size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File,
69
     unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
70
-    LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits);
71
+    LLVMMetadataRef Expr, LLVMMetadataRef Decl, LLVMDIFlags Flags,
72
+    uint32_t AlignInBits);
73
 
74
 
75
 /**
76
@@ -1246,7 +1247,7 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
77
     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
78
     size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File,
79
     unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
80
-    LLVMMetadataRef Decl, uint32_t AlignInBits);
81
+    LLVMMetadataRef Decl, LLVMDIFlags Flags, uint32_t AlignInBits);
82
 
83
 /**
84
  * Insert a new llvm.dbg.declare intrinsic call before the given instruction.
85
diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
86
index 5d62e837c1f3..490252cd018a 100644
87
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
88
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
89
@@ -22,7 +22,6 @@ namespace llvm {
90
 template <typename T> class ArrayRef;
91
 class Function;
92
 class Module;
93
-class Triple;
94
 
95
 /// Describes a possible vectorization of a function.
96
 /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized
97
@@ -81,6 +80,8 @@ class TargetLibraryInfoImpl {
98
   bool isValidProtoForLibFunc(const FunctionType &FTy, LibFunc F,
99
                               const Module &M) const;
100
 
101
+  Triple T;
102
+
103
 public:
104
   /// List of known vector-functions libraries.
105
   ///
106
@@ -95,6 +96,9 @@ public:
107
     DarwinLibSystemM, // Use Darwin's libsystem_m.
108
     LIBMVEC_X86,      // GLIBC Vector Math library.
109
     MASSV,            // IBM MASS vector library.
110
+#ifdef ENABLE_CLASSIC_FLANG
111
+    PGMATH,           // PGI math library.
112
+#endif
113
     SVML,             // Intel short vector math library.
114
     SLEEFGNUABI, // SLEEF - SIMD Library for Evaluating Elementary Functions.
115
     ArmPL        // Arm Performance Libraries.
116
diff --git a/llvm/include/llvm/Analysis/VecFuncs.def b/llvm/include/llvm/Analysis/VecFuncs.def
117
index b884c1e3911e..d1712d158423 100644
118
--- a/llvm/include/llvm/Analysis/VecFuncs.def
119
+++ b/llvm/include/llvm/Analysis/VecFuncs.def
120
@@ -909,6 +909,596 @@ TLI_DEFINE_VECFUNC("tgammaf", "armpl_vtgammaq_f32", FIXED(4), NOMASK)
121
 TLI_DEFINE_VECFUNC("tgamma", "armpl_svtgamma_f64_x",  SCALABLE(2), MASKED)
122
 TLI_DEFINE_VECFUNC("tgammaf", "armpl_svtgamma_f32_x", SCALABLE(4), MASKED)
123
 
124
+#elif defined(TLI_DEFINE_PGMATH_AARCH64_VECFUNCS)
125
+// Classic flang libpgmath library's Vector Functions for AArch64
126
+
127
+TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_2", FIXED(2))
128
+TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_4", FIXED(4))
129
+
130
+TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_2", FIXED(2))
131
+TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_4", FIXED(4))
132
+
133
+TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_2", FIXED(2))
134
+TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_4", FIXED(4))
135
+
136
+TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_2", FIXED(2))
137
+TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_4", FIXED(4))
138
+
139
+TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_2", FIXED(2))
140
+TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_4", FIXED(4))
141
+
142
+TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_2", FIXED(2))
143
+TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_4", FIXED(4))
144
+
145
+TLI_DEFINE_VECFUNC("__fd_sincos_1", "__fd_sincos_2", FIXED(2))
146
+TLI_DEFINE_VECFUNC("__fs_sincos_1", "__fs_sincos_4", FIXED(4))
147
+
148
+TLI_DEFINE_VECFUNC("__pd_sincos_1", "__pd_sincos_2", FIXED(2))
149
+TLI_DEFINE_VECFUNC("__ps_sincos_1", "__ps_sincos_4", FIXED(4))
150
+
151
+TLI_DEFINE_VECFUNC("__rd_sincos_1", "__rd_sincos_2", FIXED(2))
152
+TLI_DEFINE_VECFUNC("__rs_sincos_1", "__rs_sincos_4", FIXED(4))
153
+
154
+TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_2", FIXED(2))
155
+TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_4", FIXED(4))
156
+
157
+TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_2", FIXED(2))
158
+TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_4", FIXED(4))
159
+
160
+TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_2", FIXED(2))
161
+TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_4", FIXED(4))
162
+
163
+TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_2", FIXED(2))
164
+TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_4", FIXED(4))
165
+
166
+TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_2", FIXED(2))
167
+TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_4", FIXED(4))
168
+
169
+TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_2", FIXED(2))
170
+TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_4", FIXED(4))
171
+
172
+TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_2", FIXED(2))
173
+TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_4", FIXED(4))
174
+
175
+TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_2", FIXED(2))
176
+TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_4", FIXED(4))
177
+
178
+TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_2", FIXED(2))
179
+TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_4", FIXED(4))
180
+
181
+TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_2", FIXED(2))
182
+TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_4", FIXED(4))
183
+
184
+TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_2", FIXED(2))
185
+TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_4", FIXED(4))
186
+
187
+TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_2", FIXED(2))
188
+TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_4", FIXED(4))
189
+
190
+TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_2", FIXED(2))
191
+TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_4", FIXED(4))
192
+
193
+TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_2", FIXED(2))
194
+TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_4", FIXED(4))
195
+
196
+TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_2", FIXED(2))
197
+TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_4", FIXED(4))
198
+
199
+TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_2", FIXED(2))
200
+TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_4", FIXED(4))
201
+
202
+TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_2", FIXED(2))
203
+TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_4", FIXED(4))
204
+
205
+TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_2", FIXED(2))
206
+TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_4", FIXED(4))
207
+
208
+TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_2", FIXED(2))
209
+TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_4", FIXED(4))
210
+
211
+TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_2", FIXED(2))
212
+TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_4", FIXED(4))
213
+
214
+TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_2", FIXED(2))
215
+TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_4", FIXED(4))
216
+
217
+TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_2", FIXED(2))
218
+TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_4", FIXED(4))
219
+
220
+TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_2", FIXED(2))
221
+TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_4", FIXED(4))
222
+
223
+TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_2", FIXED(2))
224
+TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_4", FIXED(4))
225
+
226
+TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_2", FIXED(2))
227
+TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_4", FIXED(4))
228
+
229
+TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_2", FIXED(2))
230
+TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_4", FIXED(4))
231
+
232
+TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_2", FIXED(2))
233
+TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_4", FIXED(4))
234
+
235
+TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_4", FIXED(4))
236
+
237
+TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_4", FIXED(4))
238
+
239
+TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_4", FIXED(4))
240
+
241
+TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_2", FIXED(2))
242
+TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_4", FIXED(4))
243
+
244
+TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_2", FIXED(2))
245
+TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_4", FIXED(4))
246
+
247
+TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_2", FIXED(2))
248
+TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_4", FIXED(4))
249
+
250
+TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_2", FIXED(2))
251
+TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_4", FIXED(4))
252
+
253
+TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_2", FIXED(2))
254
+TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_4", FIXED(4))
255
+
256
+TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_2", FIXED(2))
257
+TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_4", FIXED(4))
258
+
259
+TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_2", FIXED(2))
260
+TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_4", FIXED(4))
261
+
262
+TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_2", FIXED(2))
263
+TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_4", FIXED(4))
264
+
265
+TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_2", FIXED(2))
266
+TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_4", FIXED(4))
267
+
268
+TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_2", FIXED(2))
269
+TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_4", FIXED(4))
270
+
271
+TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_2", FIXED(2))
272
+TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_4", FIXED(4))
273
+
274
+TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_2", FIXED(2))
275
+TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_4", FIXED(4))
276
+
277
+TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_2", FIXED(2))
278
+TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_4", FIXED(4))
279
+
280
+TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_2", FIXED(2))
281
+TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_4", FIXED(4))
282
+
283
+TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_2", FIXED(2))
284
+TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_4", FIXED(4))
285
+
286
+TLI_DEFINE_VECFUNC("__fd_exp_1", "__fd_exp_2", FIXED(2))
287
+TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_4", FIXED(4))
288
+
289
+TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_2", FIXED(2))
290
+TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_4", FIXED(4))
291
+
292
+TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_2", FIXED(2))
293
+TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_4", FIXED(4))
294
+
295
+#elif defined(TLI_DEFINE_PGMATH_X86_VECFUNCS)
296
+// Classic flang libpgmath library's Vector Functions for X86
297
+
298
+TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_2", FIXED(2))
299
+TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_4", FIXED(4))
300
+TLI_DEFINE_VECFUNC("__fd_sin_1", "__fd_sin_8", FIXED(8))
301
+
302
+TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_4", FIXED(4))
303
+TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_8", FIXED(8))
304
+TLI_DEFINE_VECFUNC("__fs_sin_1", "__fs_sin_16", FIXED(16))
305
+
306
+TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_2", FIXED(2))
307
+TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_4", FIXED(4))
308
+TLI_DEFINE_VECFUNC("__pd_sin_1", "__pd_sin_8", FIXED(8))
309
+
310
+TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_4", FIXED(4))
311
+TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_8", FIXED(8))
312
+TLI_DEFINE_VECFUNC("__ps_sin_1", "__ps_sin_16", FIXED(16))
313
+
314
+TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_2", FIXED(2))
315
+TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_4", FIXED(4))
316
+TLI_DEFINE_VECFUNC("__rd_sin_1", "__rd_sin_8", FIXED(8))
317
+
318
+TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_4", FIXED(4))
319
+TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_8", FIXED(8))
320
+TLI_DEFINE_VECFUNC("__rs_sin_1", "__rs_sin_16", FIXED(16))
321
+
322
+TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_2", FIXED(2))
323
+TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_4", FIXED(4))
324
+TLI_DEFINE_VECFUNC("__fd_cos_1", "__fd_cos_8", FIXED(8))
325
+
326
+TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_4", FIXED(4))
327
+TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_8", FIXED(8))
328
+TLI_DEFINE_VECFUNC("__fs_cos_1", "__fs_cos_16", FIXED(16))
329
+
330
+TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_2", FIXED(2))
331
+TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_4", FIXED(4))
332
+TLI_DEFINE_VECFUNC("__pd_cos_1", "__pd_cos_8", FIXED(8))
333
+
334
+TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_4", FIXED(4))
335
+TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_8", FIXED(8))
336
+TLI_DEFINE_VECFUNC("__ps_cos_1", "__ps_cos_16", FIXED(16))
337
+
338
+TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_2", FIXED(2))
339
+TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_4", FIXED(4))
340
+TLI_DEFINE_VECFUNC("__rd_cos_1", "__rd_cos_8", FIXED(8))
341
+
342
+TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_4", FIXED(4))
343
+TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_8", FIXED(8))
344
+TLI_DEFINE_VECFUNC("__rs_cos_1", "__rs_cos_16", FIXED(16))
345
+
346
+TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_2", FIXED(2))
347
+TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_4", FIXED(4))
348
+TLI_DEFINE_VECFUNC("__fd_tan_1", "__fd_tan_8", FIXED(8))
349
+
350
+TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_4", FIXED(4))
351
+TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_8", FIXED(8))
352
+TLI_DEFINE_VECFUNC("__fs_tan_1", "__fs_tan_16", FIXED(16))
353
+
354
+TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_2", FIXED(2))
355
+TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_4", FIXED(4))
356
+TLI_DEFINE_VECFUNC("__pd_tan_1", "__pd_tan_8", FIXED(8))
357
+
358
+TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_4", FIXED(4))
359
+TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_8", FIXED(8))
360
+TLI_DEFINE_VECFUNC("__ps_tan_1", "__ps_tan_16", FIXED(16))
361
+
362
+TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_2", FIXED(2))
363
+TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_4", FIXED(4))
364
+TLI_DEFINE_VECFUNC("__rd_tan_1", "__rd_tan_8", FIXED(8))
365
+
366
+TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_4", FIXED(4))
367
+TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_8", FIXED(8))
368
+TLI_DEFINE_VECFUNC("__rs_tan_1", "__rs_tan_16", FIXED(16))
369
+
370
+TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_2", FIXED(2))
371
+TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_4", FIXED(4))
372
+TLI_DEFINE_VECFUNC("__fd_sinh_1", "__fd_sinh_8", FIXED(8))
373
+
374
+TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_4", FIXED(4))
375
+TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_8", FIXED(8))
376
+TLI_DEFINE_VECFUNC("__fs_sinh_1", "__fs_sinh_16", FIXED(16))
377
+
378
+TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_2", FIXED(2))
379
+TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_4", FIXED(4))
380
+TLI_DEFINE_VECFUNC("__pd_sinh_1", "__pd_sinh_8", FIXED(8))
381
+
382
+TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_4", FIXED(4))
383
+TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_8", FIXED(8))
384
+TLI_DEFINE_VECFUNC("__ps_sinh_1", "__ps_sinh_16", FIXED(16))
385
+
386
+TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_2", FIXED(2))
387
+TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_4", FIXED(4))
388
+TLI_DEFINE_VECFUNC("__rd_sinh_1", "__rd_sinh_8", FIXED(8))
389
+
390
+TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_4", FIXED(4))
391
+TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_8", FIXED(8))
392
+TLI_DEFINE_VECFUNC("__rs_sinh_1", "__rs_sinh_16", FIXED(16))
393
+
394
+TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_2", FIXED(2))
395
+TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_4", FIXED(4))
396
+TLI_DEFINE_VECFUNC("__fd_cosh_1", "__fd_cosh_8", FIXED(8))
397
+
398
+TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_4", FIXED(4))
399
+TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_8", FIXED(8))
400
+TLI_DEFINE_VECFUNC("__fs_cosh_1", "__fs_cosh_16", FIXED(16))
401
+
402
+TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_2", FIXED(2))
403
+TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_4", FIXED(4))
404
+TLI_DEFINE_VECFUNC("__pd_cosh_1", "__pd_cosh_8", FIXED(8))
405
+
406
+TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_4", FIXED(4))
407
+TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_8", FIXED(8))
408
+TLI_DEFINE_VECFUNC("__ps_cosh_1", "__ps_cosh_16", FIXED(16))
409
+
410
+TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_2", FIXED(2))
411
+TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_4", FIXED(4))
412
+TLI_DEFINE_VECFUNC("__rd_cosh_1", "__rd_cosh_8", FIXED(8))
413
+
414
+TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_4", FIXED(4))
415
+TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_8", FIXED(8))
416
+TLI_DEFINE_VECFUNC("__rs_cosh_1", "__rs_cosh_16", FIXED(16))
417
+
418
+TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_2", FIXED(2))
419
+TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_4", FIXED(4))
420
+TLI_DEFINE_VECFUNC("__fd_tanh_1", "__fd_tanh_8", FIXED(8))
421
+
422
+TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_4", FIXED(4))
423
+TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_8", FIXED(8))
424
+TLI_DEFINE_VECFUNC("__fs_tanh_1", "__fs_tanh_16", FIXED(16))
425
+
426
+TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_2", FIXED(2))
427
+TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_4", FIXED(4))
428
+TLI_DEFINE_VECFUNC("__pd_tanh_1", "__pd_tanh_8", FIXED(8))
429
+
430
+TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_4", FIXED(4))
431
+TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_8", FIXED(8))
432
+TLI_DEFINE_VECFUNC("__ps_tanh_1", "__ps_tanh_16", FIXED(16))
433
+
434
+TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_2", FIXED(2))
435
+TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_4", FIXED(4))
436
+TLI_DEFINE_VECFUNC("__rd_tanh_1", "__rd_tanh_8", FIXED(8))
437
+
438
+TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_4", FIXED(4))
439
+TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_8", FIXED(8))
440
+TLI_DEFINE_VECFUNC("__rs_tanh_1", "__rs_tanh_16", FIXED(16))
441
+
442
+TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_2", FIXED(2))
443
+TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_4", FIXED(4))
444
+TLI_DEFINE_VECFUNC("__fd_asin_1", "__fd_asin_8", FIXED(8))
445
+
446
+TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_4", FIXED(4))
447
+TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_8", FIXED(8))
448
+TLI_DEFINE_VECFUNC("__fs_asin_1", "__fs_asin_16", FIXED(16))
449
+
450
+TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_2", FIXED(2))
451
+TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_4", FIXED(4))
452
+TLI_DEFINE_VECFUNC("__pd_asin_1", "__pd_asin_8", FIXED(8))
453
+
454
+TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_4", FIXED(4))
455
+TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_8", FIXED(8))
456
+TLI_DEFINE_VECFUNC("__ps_asin_1", "__ps_asin_16", FIXED(16))
457
+
458
+TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_2", FIXED(2))
459
+TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_4", FIXED(4))
460
+TLI_DEFINE_VECFUNC("__rd_asin_1", "__rd_asin_8", FIXED(8))
461
+
462
+TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_4", FIXED(4))
463
+TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_8", FIXED(8))
464
+TLI_DEFINE_VECFUNC("__rs_asin_1", "__rs_asin_16", FIXED(16))
465
+
466
+TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_2", FIXED(2))
467
+TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_4", FIXED(4))
468
+TLI_DEFINE_VECFUNC("__fd_acos_1", "__fd_acos_8", FIXED(8))
469
+
470
+TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_4", FIXED(4))
471
+TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_8", FIXED(8))
472
+TLI_DEFINE_VECFUNC("__fs_acos_1", "__fs_acos_16", FIXED(16))
473
+
474
+TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_2", FIXED(2))
475
+TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_4", FIXED(4))
476
+TLI_DEFINE_VECFUNC("__pd_acos_1", "__pd_acos_8", FIXED(8))
477
+
478
+TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_4", FIXED(4))
479
+TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_8", FIXED(8))
480
+TLI_DEFINE_VECFUNC("__ps_acos_1", "__ps_acos_16", FIXED(16))
481
+
482
+TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_2", FIXED(2))
483
+TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_4", FIXED(4))
484
+TLI_DEFINE_VECFUNC("__rd_acos_1", "__rd_acos_8", FIXED(8))
485
+
486
+TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_4", FIXED(4))
487
+TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_8", FIXED(8))
488
+TLI_DEFINE_VECFUNC("__rs_acos_1", "__rs_acos_16", FIXED(16))
489
+
490
+TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_2", FIXED(2))
491
+TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_4", FIXED(4))
492
+TLI_DEFINE_VECFUNC("__fd_atan_1", "__fd_atan_8", FIXED(8))
493
+
494
+TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_4", FIXED(4))
495
+TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_8", FIXED(8))
496
+TLI_DEFINE_VECFUNC("__fs_atan_1", "__fs_atan_16", FIXED(16))
497
+
498
+TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_2", FIXED(2))
499
+TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_4", FIXED(4))
500
+TLI_DEFINE_VECFUNC("__pd_atan_1", "__pd_atan_8", FIXED(8))
501
+
502
+TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_4", FIXED(4))
503
+TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_8", FIXED(8))
504
+TLI_DEFINE_VECFUNC("__ps_atan_1", "__ps_atan_16", FIXED(16))
505
+
506
+TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_2", FIXED(2))
507
+TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_4", FIXED(4))
508
+TLI_DEFINE_VECFUNC("__rd_atan_1", "__rd_atan_8", FIXED(8))
509
+
510
+TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_4", FIXED(4))
511
+TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_8", FIXED(8))
512
+TLI_DEFINE_VECFUNC("__rs_atan_1", "__rs_atan_16", FIXED(16))
513
+
514
+TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_2", FIXED(2))
515
+TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_4", FIXED(4))
516
+TLI_DEFINE_VECFUNC("__fd_atan2_1", "__fd_atan2_8", FIXED(8))
517
+
518
+TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_4", FIXED(4))
519
+TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_8", FIXED(8))
520
+TLI_DEFINE_VECFUNC("__fs_atan2_1", "__fs_atan2_16", FIXED(16))
521
+
522
+TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_2", FIXED(2))
523
+TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_4", FIXED(4))
524
+TLI_DEFINE_VECFUNC("__pd_atan2_1", "__pd_atan2_8", FIXED(8))
525
+
526
+TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_4", FIXED(4))
527
+TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_8", FIXED(8))
528
+TLI_DEFINE_VECFUNC("__ps_atan2_1", "__ps_atan2_16", FIXED(16))
529
+
530
+TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_2", FIXED(2))
531
+TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_4", FIXED(4))
532
+TLI_DEFINE_VECFUNC("__rd_atan2_1", "__rd_atan2_8", FIXED(8))
533
+
534
+TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_4", FIXED(4))
535
+TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_8", FIXED(8))
536
+TLI_DEFINE_VECFUNC("__rs_atan2_1", "__rs_atan2_16", FIXED(16))
537
+
538
+TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_2", FIXED(2))
539
+TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_4", FIXED(4))
540
+TLI_DEFINE_VECFUNC("__fd_pow_1", "__fd_pow_8", FIXED(8))
541
+
542
+TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_4", FIXED(4))
543
+TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_8", FIXED(8))
544
+TLI_DEFINE_VECFUNC("__fs_pow_1", "__fs_pow_16", FIXED(16))
545
+
546
+TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_2", FIXED(2))
547
+TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_4", FIXED(4))
548
+TLI_DEFINE_VECFUNC("__pd_pow_1", "__pd_pow_8", FIXED(8))
549
+
550
+TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_4", FIXED(4))
551
+TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_8", FIXED(8))
552
+TLI_DEFINE_VECFUNC("__ps_pow_1", "__ps_pow_16", FIXED(16))
553
+
554
+TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_2", FIXED(2))
555
+TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_4", FIXED(4))
556
+TLI_DEFINE_VECFUNC("__rd_pow_1", "__rd_pow_8", FIXED(8))
557
+
558
+TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_4", FIXED(4))
559
+TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_8", FIXED(8))
560
+TLI_DEFINE_VECFUNC("__rs_pow_1", "__rs_pow_16", FIXED(16))
561
+
562
+TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_4", FIXED(4))
563
+TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_8", FIXED(8))
564
+TLI_DEFINE_VECFUNC("__fs_powi_1", "__fs_powi_16", FIXED(16))
565
+
566
+TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_4", FIXED(4))
567
+TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_8", FIXED(8))
568
+TLI_DEFINE_VECFUNC("__ps_powi_1", "__ps_powi_16", FIXED(16))
569
+
570
+TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_4", FIXED(4))
571
+TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_8", FIXED(8))
572
+TLI_DEFINE_VECFUNC("__rs_powi_1", "__rs_powi_16", FIXED(16))
573
+
574
+TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_2", FIXED(2))
575
+TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_4", FIXED(4))
576
+TLI_DEFINE_VECFUNC("__fd_powi1_1", "__fd_powi1_8", FIXED(8))
577
+
578
+TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_4", FIXED(4))
579
+TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_8", FIXED(8))
580
+TLI_DEFINE_VECFUNC("__fs_powi1_1", "__fs_powi1_16", FIXED(16))
581
+
582
+TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_2", FIXED(2))
583
+TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_4", FIXED(4))
584
+TLI_DEFINE_VECFUNC("__pd_powi1_1", "__pd_powi1_8", FIXED(8))
585
+
586
+TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_4", FIXED(4))
587
+TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_8", FIXED(8))
588
+TLI_DEFINE_VECFUNC("__ps_powi1_1", "__ps_powi1_16", FIXED(16))
589
+
590
+TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_2", FIXED(2))
591
+TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_4", FIXED(4))
592
+TLI_DEFINE_VECFUNC("__rd_powi1_1", "__rd_powi1_8", FIXED(8))
593
+
594
+TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_4", FIXED(4))
595
+TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_8", FIXED(8))
596
+TLI_DEFINE_VECFUNC("__rs_powi1_1", "__rs_powi1_16", FIXED(16))
597
+
598
+TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_2", FIXED(2))
599
+TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_4", FIXED(4))
600
+TLI_DEFINE_VECFUNC("__fd_powk_1", "__fd_powk_8", FIXED(8))
601
+
602
+TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_4", FIXED(4))
603
+TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_8", FIXED(8))
604
+TLI_DEFINE_VECFUNC("__fs_powk_1", "__fs_powk_16", FIXED(16))
605
+
606
+TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_2", FIXED(2))
607
+TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_4", FIXED(4))
608
+TLI_DEFINE_VECFUNC("__pd_powk_1", "__pd_powk_8", FIXED(8))
609
+
610
+TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_4", FIXED(4))
611
+TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_8", FIXED(8))
612
+TLI_DEFINE_VECFUNC("__ps_powk_1", "__ps_powk_16", FIXED(16))
613
+
614
+TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_2", FIXED(2))
615
+TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_4", FIXED(4))
616
+TLI_DEFINE_VECFUNC("__rd_powk_1", "__rd_powk_8", FIXED(8))
617
+
618
+TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_4", FIXED(4))
619
+TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_8", FIXED(8))
620
+TLI_DEFINE_VECFUNC("__rs_powk_1", "__rs_powk_16", FIXED(16))
621
+
622
+TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_2", FIXED(2))
623
+TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_4", FIXED(4))
624
+TLI_DEFINE_VECFUNC("__fd_powk1_1", "__fd_powk1_8", FIXED(8))
625
+
626
+TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_4", FIXED(4))
627
+TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_8", FIXED(8))
628
+TLI_DEFINE_VECFUNC("__fs_powk1_1", "__fs_powk1_16", FIXED(16))
629
+
630
+TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_2", FIXED(2))
631
+TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_4", FIXED(4))
632
+TLI_DEFINE_VECFUNC("__pd_powk1_1", "__pd_powk1_8", FIXED(8))
633
+
634
+TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_4", FIXED(4))
635
+TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_8", FIXED(8))
636
+TLI_DEFINE_VECFUNC("__ps_powk1_1", "__ps_powk1_16", FIXED(16))
637
+
638
+TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_2", FIXED(2))
639
+TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_4", FIXED(4))
640
+TLI_DEFINE_VECFUNC("__rd_powk1_1", "__rd_powk1_8", FIXED(8))
641
+
642
+TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_4", FIXED(4))
643
+TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_8", FIXED(8))
644
+TLI_DEFINE_VECFUNC("__rs_powk1_1", "__rs_powk1_16", FIXED(16))
645
+
646
+TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_2", FIXED(2))
647
+TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_4", FIXED(4))
648
+TLI_DEFINE_VECFUNC("__fd_log10_1", "__fd_log10_8", FIXED(8))
649
+
650
+TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_4", FIXED(4))
651
+TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_8", FIXED(8))
652
+TLI_DEFINE_VECFUNC("__fs_log10_1", "__fs_log10_16", FIXED(16))
653
+
654
+TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_2", FIXED(2))
655
+TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_4", FIXED(4))
656
+TLI_DEFINE_VECFUNC("__pd_log10_1", "__pd_log10_8", FIXED(8))
657
+
658
+TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_4", FIXED(4))
659
+TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_8", FIXED(8))
660
+TLI_DEFINE_VECFUNC("__ps_log10_1", "__ps_log10_16", FIXED(16))
661
+
662
+TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_2", FIXED(2))
663
+TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_4", FIXED(4))
664
+TLI_DEFINE_VECFUNC("__rd_log10_1", "__rd_log10_8", FIXED(8))
665
+
666
+TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_4", FIXED(4))
667
+TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_8", FIXED(8))
668
+TLI_DEFINE_VECFUNC("__rs_log10_1", "__rs_log10_16", FIXED(16))
669
+
670
+TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_2", FIXED(2))
671
+TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_4", FIXED(4))
672
+TLI_DEFINE_VECFUNC("__fd_log_1", "__fd_log_8", FIXED(8))
673
+
674
+TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_4", FIXED(4))
675
+TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_8", FIXED(8))
676
+TLI_DEFINE_VECFUNC("__fs_log_1", "__fs_log_16", FIXED(16))
677
+
678
+TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_2", FIXED(2))
679
+TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_4", FIXED(4))
680
+TLI_DEFINE_VECFUNC("__pd_log_1", "__pd_log_8", FIXED(8))
681
+
682
+TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_4", FIXED(4))
683
+TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_8", FIXED(8))
684
+TLI_DEFINE_VECFUNC("__ps_log_1", "__ps_log_16", FIXED(16))
685
+
686
+TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_2", FIXED(2))
687
+TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_4", FIXED(4))
688
+TLI_DEFINE_VECFUNC("__rd_log_1", "__rd_log_8", FIXED(8))
689
+
690
+TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_4", FIXED(4))
691
+TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_8", FIXED(8))
692
+TLI_DEFINE_VECFUNC("__rs_log_1", "__rs_log_16", FIXED(16))
693
+
694
+TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_4", FIXED(4))
695
+TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_8", FIXED(8))
696
+TLI_DEFINE_VECFUNC("__fs_exp_1", "__fs_exp_16", FIXED(16))
697
+
698
+TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_2", FIXED(2))
699
+TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_4", FIXED(4))
700
+TLI_DEFINE_VECFUNC("__pd_exp_1", "__pd_exp_8", FIXED(8))
701
+
702
+TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_4", FIXED(4))
703
+TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_8", FIXED(8))
704
+TLI_DEFINE_VECFUNC("__ps_exp_1", "__ps_exp_16", FIXED(16))
705
+
706
+TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_2", FIXED(2))
707
+TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_4", FIXED(4))
708
+TLI_DEFINE_VECFUNC("__rd_exp_1", "__rd_exp_8", FIXED(8))
709
+
710
+TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_4", FIXED(4))
711
+TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_8", FIXED(8))
712
+TLI_DEFINE_VECFUNC("__rs_exp_1", "__rs_exp_16", FIXED(16))
713
+
714
 #else
715
 #error "Must choose which vector library functions are to be defined."
716
 #endif
717
@@ -929,3 +1519,5 @@ TLI_DEFINE_VECFUNC("tgammaf", "armpl_svtgamma_f32_x", SCALABLE(4), MASKED)
718
 #undef TLI_DEFINE_SLEEFGNUABI_SCALABLE_VECFUNCS
719
 #undef TLI_DEFINE_MASSV_VECFUNCS_NAMES
720
 #undef TLI_DEFINE_ARMPL_VECFUNCS
721
+#undef TLI_DEFINE_PGMATH_AARCH64_VECFUNCS
722
+#undef TLI_DEFINE_PGMATH_X86_VECFUNCS
723
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
724
index ecd6dd7b0a4f..e0e64c662f18 100644
725
--- a/llvm/include/llvm/IR/DIBuilder.h
726
+++ b/llvm/include/llvm/IR/DIBuilder.h
727
@@ -681,15 +681,22 @@ namespace llvm {
728
         DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
729
         unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
730
         DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
731
-        MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0,
732
-        DINodeArray Annotations = nullptr);
733
+        MDTuple *TemplateParams = nullptr,
734
+#ifdef ENABLE_CLASSIC_FLANG
735
+        DINode::DIFlags Flags = DINode::FlagZero,
736
+#endif
737
+        uint32_t AlignInBits = 0, DINodeArray Annotations = nullptr);
738
 
739
     /// Identical to createGlobalVariable
740
     /// except that the resulting DbgNode is temporary and meant to be RAUWed.
741
     DIGlobalVariable *createTempGlobalVariableFwdDecl(
742
         DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
743
-        unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
744
-        MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0);
745
+        unsigned LineNo, DIType *Ty, bool isLocalToUnit, MDNode *Decl = nullptr,
746
+        MDTuple *TemplateParams = nullptr,
747
+#ifdef ENABLE_CLASSIC_FLANG
748
+        DINode::DIFlags Flags = DINode::FlagZero,
749
+#endif
750
+        uint32_t AlignInBits = 0);
751
 
752
     /// Create a new descriptor for an auto variable.  This is a local variable
753
     /// that is not a subprogram parameter.
754
@@ -820,6 +827,19 @@ namespace llvm {
755
                                      StringRef Name, DIFile *File,
756
                                      unsigned LineNo);
757
 
758
+#ifdef ENABLE_CLASSIC_FLANG
759
+    /// Create common block entry for a Fortran common block
760
+    /// \param Scope       Scope of this common block
761
+    /// \param Name        The name of this common block
762
+    /// \param File        The file this common block is defined
763
+    /// \param LineNo      Line number
764
+    /// \param VarList     List of variables that a located in common block
765
+    /// \param AlignInBits Common block alignment
766
+    DICommonBlock *createCommonBlock(DIScope *Scope, DIGlobalVariable *decl,
767
+                                     StringRef Name, DIFile *File,
768
+                                     unsigned LineNo, uint32_t AlignInBits = 0);
769
+
770
+#endif
771
     /// This creates new descriptor for a namespace with the specified
772
     /// parent scope.
773
     /// \param Scope       Namespace scope
774
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
775
index 656122405209..9bd86172a4c0 100644
776
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
777
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
778
@@ -3062,12 +3062,14 @@ class DIGlobalVariable : public DIVariable {
779
 
780
   bool IsLocalToUnit;
781
   bool IsDefinition;
782
+  DIFlags Flags;
783
 
784
   DIGlobalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
785
-                   bool IsLocalToUnit, bool IsDefinition, uint32_t AlignInBits,
786
-                   ArrayRef<Metadata *> Ops)
787
+                   bool IsLocalToUnit, bool IsDefinition, DIFlags Flags,
788
+                   uint32_t AlignInBits, ArrayRef<Metadata *> Ops)
789
       : DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits),
790
-        IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
791
+        IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition),
792
+        Flags(Flags) {}
793
   ~DIGlobalVariable() = default;
794
 
795
   static DIGlobalVariable *
796
@@ -3075,12 +3077,12 @@ class DIGlobalVariable : public DIVariable {
797
           StringRef LinkageName, DIFile *File, unsigned Line, DIType *Type,
798
           bool IsLocalToUnit, bool IsDefinition,
799
           DIDerivedType *StaticDataMemberDeclaration, MDTuple *TemplateParams,
800
-          uint32_t AlignInBits, DINodeArray Annotations, StorageType Storage,
801
-          bool ShouldCreate = true) {
802
+          DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations,
803
+          StorageType Storage, bool ShouldCreate = true) {
804
     return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
805
                    getCanonicalMDString(Context, LinkageName), File, Line, Type,
806
                    IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration,
807
-                   cast_or_null<Metadata>(TemplateParams), AlignInBits,
808
+                   cast_or_null<Metadata>(TemplateParams), Flags, AlignInBits,
809
                    Annotations.get(), Storage, ShouldCreate);
810
   }
811
   static DIGlobalVariable *
812
@@ -3088,14 +3090,14 @@ class DIGlobalVariable : public DIVariable {
813
           MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
814
           bool IsLocalToUnit, bool IsDefinition,
815
           Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
816
-          uint32_t AlignInBits, Metadata *Annotations, StorageType Storage,
817
-          bool ShouldCreate = true);
818
+          DIFlags Flags, uint32_t AlignInBits, Metadata *Annotations,
819
+          StorageType Storage, bool ShouldCreate = true);
820
 
821
   TempDIGlobalVariable cloneImpl() const {
822
     return getTemporary(getContext(), getScope(), getName(), getLinkageName(),
823
                         getFile(), getLine(), getType(), isLocalToUnit(),
824
                         isDefinition(), getStaticDataMemberDeclaration(),
825
-                        getTemplateParams(), getAlignInBits(),
826
+                        getTemplateParams(), getFlags(), getAlignInBits(),
827
                         getAnnotations());
828
   }
829
 
830
@@ -3105,22 +3107,26 @@ public:
831
       (DIScope * Scope, StringRef Name, StringRef LinkageName, DIFile *File,
832
        unsigned Line, DIType *Type, bool IsLocalToUnit, bool IsDefinition,
833
        DIDerivedType *StaticDataMemberDeclaration, MDTuple *TemplateParams,
834
-       uint32_t AlignInBits, DINodeArray Annotations),
835
+       DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations),
836
       (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
837
-       StaticDataMemberDeclaration, TemplateParams, AlignInBits, Annotations))
838
+       StaticDataMemberDeclaration, TemplateParams, Flags, AlignInBits,
839
+       Annotations))
840
   DEFINE_MDNODE_GET(
841
       DIGlobalVariable,
842
       (Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
843
        unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
844
        Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
845
-       uint32_t AlignInBits, Metadata *Annotations),
846
+       DIFlags Flags, uint32_t AlignInBits, Metadata *Annotations),
847
       (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
848
-       StaticDataMemberDeclaration, TemplateParams, AlignInBits, Annotations))
849
+       StaticDataMemberDeclaration, TemplateParams, Flags, AlignInBits,
850
+       Annotations))
851
 
852
   TempDIGlobalVariable clone() const { return cloneImpl(); }
853
 
854
   bool isLocalToUnit() const { return IsLocalToUnit; }
855
   bool isDefinition() const { return IsDefinition; }
856
+  DIFlags getFlags() const { return Flags; }
857
+  bool isArtificial() const { return getFlags() & FlagArtificial; }
858
   StringRef getDisplayName() const { return getStringOperand(4); }
859
   StringRef getLinkageName() const { return getStringOperand(5); }
860
   DIDerivedType *getStaticDataMemberDeclaration() const {
861
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
862
index 05fa67d0bbf1..a6593f6b3757 100644
863
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
864
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
865
@@ -30,6 +30,10 @@ static cl::opt<TargetLibraryInfoImpl::VectorLibrary> ClVectorLibrary(
866
                           "GLIBC Vector Math library"),
867
                clEnumValN(TargetLibraryInfoImpl::MASSV, "MASSV",
868
                           "IBM MASS vector library"),
869
+#ifdef ENABLE_CLASSIC_FLANG
870
+               clEnumValN(TargetLibraryInfoImpl::PGMATH, "PGMATH",
871
+                          "PGI math library"),
872
+#endif
873
                clEnumValN(TargetLibraryInfoImpl::SVML, "SVML",
874
                           "Intel SVML library"),
875
                clEnumValN(TargetLibraryInfoImpl::SLEEFGNUABI, "sleefgnuabi",
876
@@ -867,14 +871,14 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
877
   TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary, T);
878
 }
879
 
880
-TargetLibraryInfoImpl::TargetLibraryInfoImpl() {
881
+TargetLibraryInfoImpl::TargetLibraryInfoImpl() : T(Triple()) {
882
   // Default to everything being available.
883
   memset(AvailableArray, -1, sizeof(AvailableArray));
884
 
885
-  initialize(*this, Triple(), StandardNames);
886
+  initialize(*this, T, StandardNames);
887
 }
888
 
889
-TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) {
890
+TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) : T(T) {
891
   // Default to everything being available.
892
   memset(AvailableArray, -1, sizeof(AvailableArray));
893
 
894
@@ -886,7 +890,7 @@ TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI)
895
       ShouldExtI32Return(TLI.ShouldExtI32Return),
896
       ShouldSignExtI32Param(TLI.ShouldSignExtI32Param),
897
       ShouldSignExtI32Return(TLI.ShouldSignExtI32Return),
898
-      SizeOfInt(TLI.SizeOfInt) {
899
+      SizeOfInt(TLI.SizeOfInt), T(TLI.T) {
900
   memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray));
901
   VectorDescs = TLI.VectorDescs;
902
   ScalarDescs = TLI.ScalarDescs;
903
@@ -898,7 +902,7 @@ TargetLibraryInfoImpl::TargetLibraryInfoImpl(TargetLibraryInfoImpl &&TLI)
904
       ShouldExtI32Return(TLI.ShouldExtI32Return),
905
       ShouldSignExtI32Param(TLI.ShouldSignExtI32Param),
906
       ShouldSignExtI32Return(TLI.ShouldSignExtI32Return),
907
-      SizeOfInt(TLI.SizeOfInt) {
908
+      SizeOfInt(TLI.SizeOfInt), T(TLI.T) {
909
   std::move(std::begin(TLI.AvailableArray), std::end(TLI.AvailableArray),
910
             AvailableArray);
911
   VectorDescs = TLI.VectorDescs;
912
@@ -912,6 +916,7 @@ TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(const TargetLibraryInfoI
913
   ShouldSignExtI32Param = TLI.ShouldSignExtI32Param;
914
   ShouldSignExtI32Return = TLI.ShouldSignExtI32Return;
915
   SizeOfInt = TLI.SizeOfInt;
916
+  T = TLI.T;
917
   memcpy(AvailableArray, TLI.AvailableArray, sizeof(AvailableArray));
918
   return *this;
919
 }
920
@@ -923,6 +928,7 @@ TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(TargetLibraryInfoImpl &&
921
   ShouldSignExtI32Param = TLI.ShouldSignExtI32Param;
922
   ShouldSignExtI32Return = TLI.ShouldSignExtI32Return;
923
   SizeOfInt = TLI.SizeOfInt;
924
+  T = TLI.T;
925
   std::move(std::begin(TLI.AvailableArray), std::end(TLI.AvailableArray),
926
             AvailableArray);
927
   return *this;
928
@@ -1234,6 +1240,28 @@ void TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib(
929
     }
930
     break;
931
   }
932
+#ifdef ENABLE_CLASSIC_FLANG
933
+  // NOTE: All routines listed here are not available on all the architectures.
934
+  // Based on the size of vector registers available and the size of data, the
935
+  // vector width should be chosen correctly.
936
+  case PGMATH: {
937
+    if (T.getArch() == Triple::aarch64) {
938
+      const VecDesc VecFuncs[] = {
939
+      #define TLI_DEFINE_PGMATH_AARCH64_VECFUNCS
940
+      #include "llvm/Analysis/VecFuncs.def"
941
+      };
942
+      addVectorizableFunctions(VecFuncs);
943
+    } else if (T.getArch() == Triple::x86_64) {
944
+      const VecDesc VecFuncs[] = {
945
+      #define TLI_DEFINE_PGMATH_X86_VECFUNCS
946
+      #include "llvm/Analysis/VecFuncs.def"
947
+      };
948
+      addVectorizableFunctions(VecFuncs);
949
+    }
950
+    break;
951
+  }
952
+#endif
953
+
954
   case NoLibrary:
955
     break;
956
   }
957
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
958
index 5f0d1a76de79..d7eb34e3d148 100644
959
--- a/llvm/lib/AsmParser/LLParser.cpp
960
+++ b/llvm/lib/AsmParser/LLParser.cpp
961
@@ -5405,6 +5405,22 @@ bool LLParser::parseDITemplateValueParameter(MDNode *&Result, bool IsDistinct) {
962
 ///                         isDefinition: true, templateParams: !3,
963
 ///                         declaration: !4, align: 8)
964
 bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
965
+#ifdef ENABLE_CLASSIC_FLANG
966
+#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)                                    \
967
+  OPTIONAL(name, MDStringField, (/* AllowEmpty */ true));                      \
968
+  OPTIONAL(scope, MDField, );                                                  \
969
+  OPTIONAL(linkageName, MDStringField, );                                      \
970
+  OPTIONAL(file, MDField, );                                                   \
971
+  OPTIONAL(line, LineField, );                                                 \
972
+  OPTIONAL(type, MDField, );                                                   \
973
+  OPTIONAL(isLocal, MDBoolField, );                                            \
974
+  OPTIONAL(isDefinition, MDBoolField, (true));                                 \
975
+  OPTIONAL(templateParams, MDField, );                                         \
976
+  OPTIONAL(declaration, MDField, );                                            \
977
+  OPTIONAL(flags, DIFlagField, );                                              \
978
+  OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));                           \
979
+  OPTIONAL(annotations, MDField, );
980
+#else
981
 #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)                                    \
982
   OPTIONAL(name, MDStringField, (/* AllowEmpty */ false));                     \
983
   OPTIONAL(scope, MDField, );                                                  \
984
@@ -5416,8 +5432,10 @@ bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
985
   OPTIONAL(isDefinition, MDBoolField, (true));                                 \
986
   OPTIONAL(templateParams, MDField, );                                         \
987
   OPTIONAL(declaration, MDField, );                                            \
988
+  OPTIONAL(flags, DIFlagField, );                                              \
989
   OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));                           \
990
   OPTIONAL(annotations, MDField, );
991
+#endif
992
   PARSE_MD_FIELDS();
993
 #undef VISIT_MD_FIELDS
994
 
995
@@ -5425,8 +5443,8 @@ bool LLParser::parseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
996
       GET_OR_DISTINCT(DIGlobalVariable,
997
                       (Context, scope.Val, name.Val, linkageName.Val, file.Val,
998
                        line.Val, type.Val, isLocal.Val, isDefinition.Val,
999
-                       declaration.Val, templateParams.Val, align.Val,
1000
-                       annotations.Val));
1001
+                       declaration.Val, templateParams.Val, flags.Val,
1002
+                       align.Val, annotations.Val));
1003
   return false;
1004
 }
1005
 
1006
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
1007
index 0a9a80688a41..c21e5e5dba97 100644
1008
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
1009
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
1010
@@ -1979,25 +1979,43 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
1011
     break;
1012
   }
1013
   case bitc::METADATA_GLOBAL_VAR: {
1014
-    if (Record.size() < 11 || Record.size() > 13)
1015
+    if (Record.size() < 11 || Record.size() > 14)
1016
       return error("Invalid record");
1017
 
1018
     IsDistinct = Record[0] & 1;
1019
     unsigned Version = Record[0] >> 1;
1020
 
1021
-    if (Version == 2) {
1022
+    if (Version == 3) {
1023
+      // Add support for DIFlags
1024
+      Metadata *Annotations = nullptr;
1025
+      if (Record.size() > 13)
1026
+        Annotations = getMDOrNull(Record[13]);
1027
+
1028
+      MetadataList.assignValue(
1029
+          GET_OR_DISTINCT(
1030
+              DIGlobalVariable,
1031
+              (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
1032
+               getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
1033
+               getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1034
+               getMDOrNull(Record[9]), getMDOrNull(Record[10]),
1035
+               static_cast<DINode::DIFlags>(Record[11]), Record[12],
1036
+               Annotations)),
1037
+          NextMetadataNo);
1038
+
1039
+      NextMetadataNo++;
1040
+    } else if (Version == 2) {
1041
       Metadata *Annotations = nullptr;
1042
       if (Record.size() > 12)
1043
         Annotations = getMDOrNull(Record[12]);
1044
 
1045
       MetadataList.assignValue(
1046
-          GET_OR_DISTINCT(DIGlobalVariable,
1047
-                          (Context, getMDOrNull(Record[1]),
1048
-                           getMDString(Record[2]), getMDString(Record[3]),
1049
-                           getMDOrNull(Record[4]), Record[5],
1050
-                           getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1051
-                           getMDOrNull(Record[9]), getMDOrNull(Record[10]),
1052
-                           Record[11], Annotations)),
1053
+          GET_OR_DISTINCT(
1054
+              DIGlobalVariable,
1055
+              (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
1056
+               getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
1057
+               getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1058
+               getMDOrNull(Record[9]), getMDOrNull(Record[10]),
1059
+               DINode::FlagZero, Record[11], Annotations)),
1060
           NextMetadataNo);
1061
 
1062
       NextMetadataNo++;
1063
@@ -2010,7 +2028,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
1064
               (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
1065
                getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
1066
                getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1067
-               getMDOrNull(Record[10]), nullptr, Record[11], nullptr)),
1068
+               getMDOrNull(Record[10]), nullptr, DINode::FlagZero, Record[11],
1069
+               nullptr)),
1070
           NextMetadataNo);
1071
 
1072
       NextMetadataNo++;
1073
@@ -2043,7 +2062,8 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
1074
           (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
1075
            getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
1076
            getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1077
-           getMDOrNull(Record[10]), nullptr, AlignInBits, nullptr));
1078
+           getMDOrNull(Record[10]), nullptr, DINode::FlagZero, AlignInBits,
1079
+           nullptr));
1080
 
1081
       DIGlobalVariableExpression *DGVE = nullptr;
1082
       if (Attach || Expr)
1083
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
1084
index 9416c7f5a03e..013e7ce2d425 100644
1085
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
1086
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
1087
@@ -2014,7 +2014,7 @@ void ModuleBitcodeWriter::writeDITemplateValueParameter(
1088
 void ModuleBitcodeWriter::writeDIGlobalVariable(
1089
     const DIGlobalVariable *N, SmallVectorImpl<uint64_t> &Record,
1090
     unsigned Abbrev) {
1091
-  const uint64_t Version = 2 << 1;
1092
+  const uint64_t Version = 3 << 1;
1093
   Record.push_back((uint64_t)N->isDistinct() | Version);
1094
   Record.push_back(VE.getMetadataOrNullID(N->getScope()));
1095
   Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
1096
@@ -2026,6 +2026,7 @@ void ModuleBitcodeWriter::writeDIGlobalVariable(
1097
   Record.push_back(N->isDefinition());
1098
   Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration()));
1099
   Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams()));
1100
+  Record.push_back(N->getFlags());
1101
   Record.push_back(N->getAlignInBits());
1102
   Record.push_back(VE.getMetadataOrNullID(N->getAnnotations().get()));
1103
 
1104
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
1105
index 726aba18bb80..ee8be3921ab7 100644
1106
--- a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
1107
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
1108
@@ -115,6 +115,29 @@ class DbgValueLoc {
1109
   SmallVector<DbgValueLocEntry, 2> ValueLocEntries;
1110
 
1111
   bool IsVariadic;
1112
+  /// Type of entry that this represents.
1113
+  enum EntryType {
1114
+    E_Location,
1115
+    E_Integer,
1116
+    E_ConstantFP,
1117
+    E_ConstantInt,
1118
+    E_TargetIndexLocation
1119
+  };
1120
+  enum EntryType EntryKind;
1121
+
1122
+  /// Either a constant,
1123
+  union {
1124
+    int64_t Int;
1125
+    const ConstantFP *CFP;
1126
+    const ConstantInt *CIP;
1127
+  } Constant;
1128
+
1129
+  union {
1130
+    /// Or a location in the machine frame.
1131
+    MachineLocation Loc;
1132
+    /// Or a location from target specific location.
1133
+    TargetIndexLocation TIL;
1134
+  };
1135
 
1136
 public:
1137
   DbgValueLoc(const DIExpression *Expr, ArrayRef<DbgValueLocEntry> Locs)
1138
@@ -139,6 +162,37 @@ public:
1139
     assert(((Expr && Expr->isValid()) || !Loc.isLocation()) &&
1140
            "DBG_VALUE with a machine location must have a valid expression.");
1141
   }
1142
+  DbgValueLoc(const DIExpression *Expr, int64_t i)
1143
+      : Expression(Expr), EntryKind(E_Integer) {
1144
+    Constant.Int = i;
1145
+  }
1146
+  DbgValueLoc(const DIExpression *Expr, const ConstantFP *CFP)
1147
+      : Expression(Expr), EntryKind(E_ConstantFP) {
1148
+    Constant.CFP = CFP;
1149
+  }
1150
+  DbgValueLoc(const DIExpression *Expr, const ConstantInt *CIP)
1151
+      : Expression(Expr), EntryKind(E_ConstantInt) {
1152
+    Constant.CIP = CIP;
1153
+  }
1154
+  DbgValueLoc(const DIExpression *Expr, MachineLocation Loc)
1155
+      : Expression(Expr), EntryKind(E_Location), Loc(Loc) {
1156
+    assert(cast<DIExpression>(Expr)->isValid());
1157
+  }
1158
+  DbgValueLoc(const DIExpression *Expr, TargetIndexLocation Loc)
1159
+      : Expression(Expr), EntryKind(E_TargetIndexLocation), TIL(Loc) {}
1160
+
1161
+  bool isLocation() const { return EntryKind == E_Location; }
1162
+  bool isTargetIndexLocation() const {
1163
+    return EntryKind == E_TargetIndexLocation;
1164
+  }
1165
+  bool isInt() const { return EntryKind == E_Integer; }
1166
+  bool isConstantFP() const { return EntryKind == E_ConstantFP; }
1167
+  bool isConstantInt() const { return EntryKind == E_ConstantInt; }
1168
+  int64_t getInt() const { return Constant.Int; }
1169
+  const ConstantFP *getConstantFP() const { return Constant.CFP; }
1170
+  const ConstantInt *getConstantInt() const { return Constant.CIP; }
1171
+  MachineLocation getLoc() const { return Loc; }
1172
+  TargetIndexLocation getTargetIndexLocation() const { return TIL; }
1173
 
1174
   bool isFragment() const { return getExpression()->isFragment(); }
1175
   bool isEntryVal() const { return getExpression()->isEntryValue(); }
1176
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp
1177
index 8c6109880afc..fbfcf65a34ec 100644
1178
--- a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp
1179
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp
1180
@@ -38,6 +38,11 @@ void DebugLocStream::finalizeEntry() {
1181
 }
1182
 
1183
 DebugLocStream::ListBuilder::~ListBuilder() {
1184
+#ifdef ENABLE_CLASSIC_FLANG
1185
+  if (Finalized)
1186
+    return;
1187
+  Finalized = true;
1188
+#endif
1189
   if (!Locs.finalizeList(Asm))
1190
     return;
1191
   V.initializeDbgValue(&MI);
1192
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
1193
index a96bdd034918..0600f4f09d5e 100644
1194
--- a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
1195
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
1196
@@ -158,12 +158,18 @@ class DebugLocStream::ListBuilder {
1197
   DbgVariable &V;
1198
   const MachineInstr &MI;
1199
   size_t ListIndex;
1200
+#ifdef ENABLE_CLASSIC_FLANG
1201
+  bool Finalized;
1202
+#endif
1203
   std::optional<uint8_t> TagOffset;
1204
 
1205
 public:
1206
   ListBuilder(DebugLocStream &Locs, DwarfCompileUnit &CU, AsmPrinter &Asm,
1207
               DbgVariable &V, const MachineInstr &MI)
1208
       : Locs(Locs), Asm(Asm), V(V), MI(MI), ListIndex(Locs.startList(&CU)),
1209
+#ifdef ENABLE_CLASSIC_FLANG
1210
+        Finalized(false),
1211
+#endif
1212
         TagOffset(std::nullopt) {}
1213
 
1214
   void setTagOffset(uint8_t TO) {
1215
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
1216
index 58ed21379d29..78ff0d351492 100644
1217
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
1218
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
1219
@@ -185,6 +185,9 @@ DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
1220
   else
1221
     addGlobalName(GV->getName(), *VariableDIE, DeclContext);
1222
 
1223
+  if (GV->isArtificial())
1224
+    addFlag(*VariableDIE, dwarf::DW_AT_artificial);
1225
+
1226
   addAnnotation(*VariableDIE, GV->getAnnotations());
1227
 
1228
   if (uint32_t AlignInBytes = GV->getAlignInBytes())
1229
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
1230
index 1af4b643eb17..e526614792c7 100644
1231
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
1232
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
1233
@@ -284,6 +284,8 @@ struct SymbolCU {
1234
   DwarfCompileUnit *CU;
1235
 };
1236
 
1237
+class DummyDwarfExpression;
1238
+
1239
 /// The kind of accelerator tables we should emit.
1240
 enum class AccelTableKind {
1241
   Default, ///< Platform default.
1242
@@ -437,6 +439,8 @@ private:
1243
   /// Map for tracking Fortran deferred CHARACTER lengths.
1244
   DenseMap<const DIStringType *, unsigned> StringTypeLocMap;
1245
 
1246
+  DenseMap<const DIVariable*,const DIType*> VariableInDependentType;
1247
+
1248
   AddressPool AddrPool;
1249
 
1250
   /// Accelerator tables.
1251
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
1252
index be4a3ed79d88..c47dd4664ea6 100644
1253
--- a/llvm/lib/IR/AsmWriter.cpp
1254
+++ b/llvm/lib/IR/AsmWriter.cpp
1255
@@ -2281,6 +2281,7 @@ static void writeDIGlobalVariable(raw_ostream &Out, const DIGlobalVariable *N,
1256
   Printer.printBool("isDefinition", N->isDefinition());
1257
   Printer.printMetadata("declaration", N->getRawStaticDataMemberDeclaration());
1258
   Printer.printMetadata("templateParams", N->getRawTemplateParams());
1259
+  Printer.printDIFlags("flags", N->getFlags());
1260
   Printer.printInt("align", N->getAlignInBits());
1261
   Printer.printMetadata("annotations", N->getRawAnnotations());
1262
   Out << ")";
1263
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
1264
index 1ce8c17f8a88..af6ebf702165 100644
1265
--- a/llvm/lib/IR/DIBuilder.cpp
1266
+++ b/llvm/lib/IR/DIBuilder.cpp
1267
@@ -725,14 +725,14 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
1268
     DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
1269
     unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, bool isDefined,
1270
     DIExpression *Expr, MDNode *Decl, MDTuple *TemplateParams,
1271
-    uint32_t AlignInBits, DINodeArray Annotations) {
1272
+    DINode::DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations) {
1273
   checkGlobalVariableScope(Context);
1274
 
1275
   auto *GV = DIGlobalVariable::getDistinct(
1276
       VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
1277
       LineNumber, Ty, IsLocalToUnit, isDefined,
1278
-      cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
1279
-      Annotations);
1280
+      cast_or_null<DIDerivedType>(Decl), TemplateParams, Flags,
1281
+      AlignInBits, Annotations);
1282
   if (!Expr)
1283
     Expr = createExpression();
1284
   auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
1285
@@ -743,14 +743,14 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
1286
 DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
1287
     DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
1288
     unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl,
1289
-    MDTuple *TemplateParams, uint32_t AlignInBits) {
1290
+    MDTuple *TemplateParams, DINode::DIFlags Flags, uint32_t AlignInBits) {
1291
   checkGlobalVariableScope(Context);
1292
 
1293
   return DIGlobalVariable::getTemporary(
1294
              VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
1295
              LineNumber, Ty, IsLocalToUnit, false,
1296
-             cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
1297
-             nullptr)
1298
+             cast_or_null<DIDerivedType>(Decl), TemplateParams, Flags,
1299
+             AlignInBits, nullptr)
1300
       .release();
1301
 }
1302
 
1303
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
1304
index 48b5501c55ba..3696beccdd0c 100644
1305
--- a/llvm/lib/IR/DebugInfo.cpp
1306
+++ b/llvm/lib/IR/DebugInfo.cpp
1307
@@ -1547,12 +1547,13 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(
1308
     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1309
     size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File,
1310
     unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
1311
-    LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits) {
1312
+    LLVMMetadataRef Expr, LLVMMetadataRef Decl, LLVMDIFlags Flags,
1313
+    uint32_t AlignInBits) {
1314
   return wrap(unwrap(Builder)->createGlobalVariableExpression(
1315
       unwrapDI<DIScope>(Scope), {Name, NameLen}, {Linkage, LinkLen},
1316
       unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
1317
       true, unwrap<DIExpression>(Expr), unwrapDI<MDNode>(Decl),
1318
-      nullptr, AlignInBits));
1319
+      nullptr, map_from_llvmDIFlags(Flags), AlignInBits));
1320
 }
1321
 
1322
 LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE) {
1323
@@ -1597,11 +1598,12 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
1324
     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1325
     size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File,
1326
     unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
1327
-    LLVMMetadataRef Decl, uint32_t AlignInBits) {
1328
+    LLVMMetadataRef Decl, LLVMDIFlags Flags, uint32_t AlignInBits) {
1329
   return wrap(unwrap(Builder)->createTempGlobalVariableFwdDecl(
1330
       unwrapDI<DIScope>(Scope), {Name, NameLen}, {Linkage, LnkLen},
1331
       unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
1332
-      unwrapDI<MDNode>(Decl), nullptr, AlignInBits));
1333
+      unwrapDI<MDNode>(Decl), nullptr, map_from_llvmDIFlags(Flags),
1334
+      AlignInBits));
1335
 }
1336
 
1337
 LLVMValueRef
1338
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
1339
index 4933b6032688..d599896ee456 100644
1340
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
1341
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
1342
@@ -1258,15 +1258,16 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
1343
                           MDString *LinkageName, Metadata *File, unsigned Line,
1344
                           Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
1345
                           Metadata *StaticDataMemberDeclaration,
1346
-                          Metadata *TemplateParams, uint32_t AlignInBits,
1347
-                          Metadata *Annotations, StorageType Storage,
1348
-                          bool ShouldCreate) {
1349
+                          Metadata *TemplateParams, DIFlags Flags,
1350
+                          uint32_t AlignInBits, Metadata *Annotations,
1351
+                          StorageType Storage, bool ShouldCreate) {
1352
   assert(isCanonical(Name) && "Expected canonical MDString");
1353
   assert(isCanonical(LinkageName) && "Expected canonical MDString");
1354
   DEFINE_GETIMPL_LOOKUP(
1355
       DIGlobalVariable,
1356
       (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
1357
-       StaticDataMemberDeclaration, TemplateParams, AlignInBits, Annotations));
1358
+       StaticDataMemberDeclaration, TemplateParams, Flags, AlignInBits,
1359
+       Annotations));
1360
   Metadata *Ops[] = {Scope,
1361
                      Name,
1362
                      File,
1363
@@ -1277,7 +1278,8 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
1364
                      TemplateParams,
1365
                      Annotations};
1366
   DEFINE_GETIMPL_STORE(DIGlobalVariable,
1367
-                       (Line, IsLocalToUnit, IsDefinition, AlignInBits), Ops);
1368
+                       (Line, IsLocalToUnit, IsDefinition, Flags, AlignInBits),
1369
+                       Ops);
1370
 }
1371
 
1372
 DILocalVariable *
1373
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
1374
index 4cc3f8da6b75..8a621725f55e 100644
1375
--- a/llvm/lib/IR/LLVMContextImpl.h
1376
+++ b/llvm/lib/IR/LLVMContextImpl.h
1377
@@ -1055,6 +1055,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
1378
   bool IsDefinition;
1379
   Metadata *StaticDataMemberDeclaration;
1380
   Metadata *TemplateParams;
1381
+  unsigned Flags;
1382
   uint32_t AlignInBits;
1383
   Metadata *Annotations;
1384
 
1385
@@ -1062,20 +1063,21 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
1386
                 Metadata *File, unsigned Line, Metadata *Type,
1387
                 bool IsLocalToUnit, bool IsDefinition,
1388
                 Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
1389
+                unsigned Flags,
1390
                 uint32_t AlignInBits, Metadata *Annotations)
1391
       : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
1392
         Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
1393
         IsDefinition(IsDefinition),
1394
         StaticDataMemberDeclaration(StaticDataMemberDeclaration),
1395
-        TemplateParams(TemplateParams), AlignInBits(AlignInBits),
1396
-        Annotations(Annotations) {}
1397
+        TemplateParams(TemplateParams), Flags(Flags),
1398
+        AlignInBits(AlignInBits), Annotations(Annotations) {}
1399
   MDNodeKeyImpl(const DIGlobalVariable *N)
1400
       : Scope(N->getRawScope()), Name(N->getRawName()),
1401
         LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
1402
         Line(N->getLine()), Type(N->getRawType()),
1403
         IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
1404
         StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()),
1405
-        TemplateParams(N->getRawTemplateParams()),
1406
+        TemplateParams(N->getRawTemplateParams()), Flags(N->getFlags()),
1407
         AlignInBits(N->getAlignInBits()), Annotations(N->getRawAnnotations()) {}
1408
 
1409
   bool isKeyOf(const DIGlobalVariable *RHS) const {
1410
@@ -1087,6 +1089,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
1411
            StaticDataMemberDeclaration ==
1412
                RHS->getRawStaticDataMemberDeclaration() &&
1413
            TemplateParams == RHS->getRawTemplateParams() &&
1414
+           Flags == RHS->getFlags() &&
1415
            AlignInBits == RHS->getAlignInBits() &&
1416
            Annotations == RHS->getRawAnnotations();
1417
   }
1418
@@ -1101,7 +1104,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
1419
     // TODO: make hashing work fine with such situations
1420
     return hash_combine(Scope, Name, LinkageName, File, Line, Type,
1421
                         IsLocalToUnit, IsDefinition, /* AlignInBits, */
1422
-                        StaticDataMemberDeclaration, Annotations);
1423
+                        StaticDataMemberDeclaration, Flags, Annotations);
1424
   }
1425
 };
1426
 
1427
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
1428
index a7b1953ce81c..136132d7e65a 100644
1429
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
1430
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
1431
@@ -1052,8 +1052,8 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfInstBase *Inc) {
1432
           SP, CounterPtr->getName(), /*LinkageName=*/StringRef(), SP->getFile(),
1433
           /*LineNo=*/0, DB.createUnspecifiedType("Profile Data Type"),
1434
           CounterPtr->hasLocalLinkage(), /*IsDefined=*/true, /*Expr=*/nullptr,
1435
-          /*Decl=*/nullptr, /*TemplateParams=*/nullptr, /*AlignInBits=*/0,
1436
-          Annotations);
1437
+          /*Decl=*/nullptr, /*TemplateParams=*/nullptr,
1438
+          /*Flags=*/DINode::FlagZero, /*AlignInBits=*/0, Annotations);
1439
       CounterPtr->addDebugInfo(DICounter);
1440
       DB.finalize();
1441
     } else {
1442
diff --git a/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll b/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll
1443
index a4e69f3c8b75..d3c476a03198 100644
1444
--- a/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll
1445
+++ b/llvm/test/Assembler/invalid-diglobalvariable-empty-name.ll
1446
@@ -1,4 +1,5 @@
1447
 ; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
1448
+; UNSUPPORTED: classic_flang
1449
 
1450
 ; CHECK: <stdin>:[[@LINE+1]]:30: error: 'name' cannot be empty
1451
 !0 = !DIGlobalVariable(name: "")
1452
diff --git a/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll b/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll
1453
new file mode 100644
1454
index 000000000000..988c388fe218
1455
--- /dev/null
1456
+++ b/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll
1457
@@ -0,0 +1,24 @@
1458
+; Test for DIFlagPure, DIFlagElement and DIFlagRecursive. These three
1459
+; DIFlags are used to attach DW_AT_pure, DW_AT_element, and DW_AT_recursive
1460
+; attributes to DW_TAG_subprogram DIEs.
1461
+
1462
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
1463
+; CHECK: !DISubprogram({{.*}}, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive,
1464
+
1465
+!llvm.module.flags = !{!0, !1}
1466
+!llvm.dbg.cu = !{!2}
1467
+
1468
+define void @subprgm() !dbg !6 {
1469
+L:
1470
+  ret void
1471
+}
1472
+
1473
+!0 = !{i32 2, !"Dwarf Version", i32 2}
1474
+!1 = !{i32 1, !"Debug Info Version", i32 3}
1475
+!2 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: "Flang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !4, imports: !4)
1476
+!3 = !DIFile(filename: "fortran-subprogram-at.f", directory: "/")
1477
+!4 = !{}
1478
+!5 = !DIBasicType(name: "real", size: 32, align: 32, encoding: DW_ATE_float)
1479
+!6 = distinct !DISubprogram(name: "subprgm", scope: !2, file: !3, line: 256, type: !7, scopeLine: 256, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, unit: !2)
1480
+!7 = !DISubroutineType(types: !8)
1481
+!8 = !{null, !5}
1482
diff --git a/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll b/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll
1483
new file mode 100644
1484
index 000000000000..0533cf6b2367
1485
--- /dev/null
1486
+++ b/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll
1487
@@ -0,0 +1,38 @@
1488
+; REQUIRES: object-emission
1489
+
1490
+; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
1491
+; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s
1492
+
1493
+; Make sure we're emitting DW_AT_{pure,elemental,recursive}.
1494
+; CHECK: DW_TAG_subprogram
1495
+; CHECK-NOT: {{DW_TAG|NULL}}
1496
+; CHECK:   DW_AT_name {{.*}} "main"
1497
+; CHECK-NOT: {{DW_TAG|NULL}}
1498
+; CHECK:   DW_AT_pure [DW_FORM_flag_present] (true)
1499
+; CHECK:   DW_AT_elemental [DW_FORM_flag_present] (true)
1500
+; CHECK:   DW_AT_recursive [DW_FORM_flag_present] (true)
1501
+
1502
+define dso_local i32 @main() !dbg !7 {
1503
+entry:
1504
+  %retval = alloca i32, align 4
1505
+  store i32 0, i32* %retval, align 4
1506
+  ret i32 0, !dbg !12
1507
+}
1508
+
1509
+!llvm.dbg.cu = !{!0}
1510
+!llvm.module.flags = !{!3, !4, !5}
1511
+!llvm.ident = !{!6}
1512
+
1513
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
1514
+!1 = !DIFile(filename: "x.c", directory: "/tmp")
1515
+!2 = !{}
1516
+!3 = !{i32 2, !"Dwarf Version", i32 4}
1517
+!4 = !{i32 2, !"Debug Info Version", i32 3}
1518
+!5 = !{i32 1, !"wchar_size", i32 4}
1519
+!6 = !{!"clang"}
1520
+!7 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 1, type: !9, scopeLine: 2, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, unit: !0, retainedNodes: !2)
1521
+!8 = !DIFile(filename: "x.c", directory: "/tmp")
1522
+!9 = !DISubroutineType(types: !10)
1523
+!10 = !{!11}
1524
+!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
1525
+!12 = !DILocation(line: 3, column: 3, scope: !7)
1526
diff --git a/llvm/test/DebugInfo/X86/DICommonBlock.ll b/llvm/test/DebugInfo/X86/DICommonBlock.ll
1527
new file mode 100644
1528
index 000000000000..6cfb7a90640d
1529
--- /dev/null
1530
+++ b/llvm/test/DebugInfo/X86/DICommonBlock.ll
1531
@@ -0,0 +1,36 @@
1532
+; ModuleID = 'none.f90'
1533
+; RUN: llc %s -o %t -filetype=obj
1534
+; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
1535
+; CHECK: DW_TAG_common_block
1536
+
1537
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
1538
+target triple = "x86_64-apple-macosx"
1539
+
1540
+@common_a = common global [32 x i8] zeroinitializer, align 8, !dbg !13
1541
+
1542
+define i32 @subr() !dbg !9 {
1543
+    %1 = getelementptr inbounds [32 x i8], [32 x i8]* @common_a, i64 0, i32 8
1544
+    %2 = bitcast i8* %1 to i32*
1545
+    %3 = load i32, i32* %2
1546
+    ret i32 %3
1547
+}
1548
+
1549
+!llvm.dbg.cu = !{!0}
1550
+!llvm.module.flags = !{!6, !7}
1551
+!llvm.ident = !{!8}
1552
+
1553
+!0 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !1, producer: "PGI Fortran", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, retainedTypes: !14, globals: !2)
1554
+!1 = !DIFile(filename: "none.f90", directory: "/not/here/")
1555
+!2 = !{!13}
1556
+!3 = !{}
1557
+!4 = !DIGlobalVariable(name: "common /a/", scope: !5, file: !1, line: 4, isLocal: false, isDefinition: true, type: !12)
1558
+!5 = !DICommonBlock(scope: !9, declaration: !4, name: "a", file: !1, line: 4)
1559
+!6 = !{i32 2, !"Dwarf Version", i32 4}
1560
+!7 = !{i32 2, !"Debug Info Version", i32 3}
1561
+!8 = !{!"PGI Fortran"}
1562
+!9 = distinct !DISubprogram(name: "subrtn", scope: !0, file: !1, line: 1, type: !10, isLocal: false, isDefinition: true, unit: !0)
1563
+!10 = !DISubroutineType(types: !11)
1564
+!11 = !{!12, !12}
1565
+!12 = !DIBasicType(name: "int", size: 32)
1566
+!13 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression())
1567
+!14 = !{!12, !10}
1568
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
1569
index 4114bf7f54b2..9cc8520960c2 100644
1570
--- a/llvm/test/lit.cfg.py
1571
+++ b/llvm/test/lit.cfg.py
1572
@@ -645,3 +645,6 @@ if "aix" in config.target_triple:
1573
 # "OBJECT_MODE" to 'any' by default on AIX OS.
1574
 if "system-aix" in config.available_features:
1575
     config.environment["OBJECT_MODE"] = "any"
1576
+
1577
+if config.use_classic_flang:
1578
+    config.available_features.add("classic_flang")
1579
diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in
1580
index 57ee2100dfb7..fc7ab6536309 100644
1581
--- a/llvm/test/lit.site.cfg.py.in
1582
+++ b/llvm/test/lit.site.cfg.py.in
1583
@@ -61,6 +61,7 @@ config.expensive_checks = @LLVM_ENABLE_EXPENSIVE_CHECKS@
1584
 config.reverse_iteration = @LLVM_ENABLE_REVERSE_ITERATION@
1585
 config.dxil_tests = @LLVM_INCLUDE_DXIL_TESTS@
1586
 config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@
1587
+config.use_classic_flang = @LLVM_ENABLE_CLASSIC_FLANG@
1588
 
1589
 import lit.llvm
1590
 lit.llvm.initialize(lit_config, config)
1591
diff --git a/llvm/tools/llvm-c-test/debuginfo.c b/llvm/tools/llvm-c-test/debuginfo.c
1592
index a3e41be12e95..906c96f1c24b 100644
1593
--- a/llvm/tools/llvm-c-test/debuginfo.c
1594
+++ b/llvm/tools/llvm-c-test/debuginfo.c
1595
@@ -64,7 +64,7 @@ int llvm_test_dibuilder(void) {
1596
       LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
1597
   LLVMDIBuilderCreateGlobalVariableExpression(
1598
       DIB, Module, "globalClass", 11, "", 0, File, 1, ClassTy, true,
1599
-      GlobalClassValueExpr, NULL, 0);
1600
+      GlobalClassValueExpr, NULL, LLVMDIFlagZero, 0);
1601
 
1602
   LLVMMetadataRef Int64Ty =
1603
       LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0, LLVMDIFlagZero);
1604
@@ -75,7 +75,7 @@ int llvm_test_dibuilder(void) {
1605
       LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
1606
   LLVMDIBuilderCreateGlobalVariableExpression(
1607
       DIB, Module, "global", 6, "", 0, File, 1, Int64TypeDef, true,
1608
-      GlobalVarValueExpr, NULL, 0);
1609
+      GlobalVarValueExpr, NULL, LLVMDIFlagZero, 0);
1610
 
1611
   LLVMMetadataRef NameSpace =
1612
       LLVMDIBuilderCreateNameSpace(DIB, Module, "NameSpace", 9, false);
1613
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
1614
index 5342360109d0..4bce26851d2f 100644
1615
--- a/llvm/unittests/IR/MetadataTest.cpp
1616
+++ b/llvm/unittests/IR/MetadataTest.cpp
1617
@@ -2896,12 +2896,13 @@ TEST_F(DIGlobalVariableTest, get) {
1618
   DIDerivedType *StaticDataMemberDeclaration =
1619
       cast<DIDerivedType>(getDerivedType());
1620
 
1621
+  DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
1622
   uint32_t AlignInBits = 8;
1623
 
1624
   auto *N = DIGlobalVariable::get(
1625
       Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
1626
-      IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits,
1627
-      nullptr);
1628
+      IsDefinition, StaticDataMemberDeclaration, templateParams, Flags,
1629
+      AlignInBits, nullptr);
1630
 
1631
   EXPECT_EQ(dwarf::DW_TAG_variable, N->getTag());
1632
   EXPECT_EQ(Scope, N->getScope());
1633
@@ -2914,57 +2915,66 @@ TEST_F(DIGlobalVariableTest, get) {
1634
   EXPECT_EQ(IsDefinition, N->isDefinition());
1635
   EXPECT_EQ(StaticDataMemberDeclaration, N->getStaticDataMemberDeclaration());
1636
   EXPECT_EQ(templateParams, N->getTemplateParams());
1637
+  EXPECT_EQ(Flags, N->getFlags());
1638
   EXPECT_EQ(AlignInBits, N->getAlignInBits());
1639
   EXPECT_EQ(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1640
                                      Line, Type, IsLocalToUnit, IsDefinition,
1641
                                      StaticDataMemberDeclaration,
1642
-                                     templateParams, AlignInBits, nullptr));
1643
+                                     templateParams, Flags, AlignInBits,
1644
+                                     nullptr));
1645
 
1646
   EXPECT_NE(N, DIGlobalVariable::get(
1647
                    Context, getSubprogram(), Name, LinkageName, File, Line,
1648
                    Type, IsLocalToUnit, IsDefinition,
1649
-                   StaticDataMemberDeclaration, templateParams, AlignInBits,
1650
-                   nullptr));
1651
+                   StaticDataMemberDeclaration, templateParams, Flags,
1652
+                   AlignInBits, nullptr));
1653
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, "other", LinkageName, File,
1654
                                      Line, Type, IsLocalToUnit, IsDefinition,
1655
                                      StaticDataMemberDeclaration,
1656
-                                     templateParams, AlignInBits, nullptr));
1657
+                                     templateParams, Flags, AlignInBits,
1658
+                                     nullptr));
1659
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, "other", File, Line,
1660
                                      Type, IsLocalToUnit, IsDefinition,
1661
                                      StaticDataMemberDeclaration,
1662
-                                     templateParams, AlignInBits, nullptr));
1663
+                                     templateParams, Flags, AlignInBits, nullptr));
1664
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName,
1665
                                      getFile(), Line, Type, IsLocalToUnit,
1666
                                      IsDefinition, StaticDataMemberDeclaration,
1667
-                                     templateParams, AlignInBits, nullptr));
1668
+                                     templateParams, Flags, AlignInBits, nullptr));
1669
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1670
                                      Line + 1, Type, IsLocalToUnit,
1671
                                      IsDefinition, StaticDataMemberDeclaration,
1672
-                                     templateParams, AlignInBits, nullptr));
1673
+                                     templateParams, Flags, AlignInBits, nullptr));
1674
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1675
                                      Line, getDerivedType(), IsLocalToUnit,
1676
                                      IsDefinition, StaticDataMemberDeclaration,
1677
-                                     templateParams, AlignInBits, nullptr));
1678
+                                     templateParams, Flags, AlignInBits, nullptr));
1679
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1680
                                      Line, Type, !IsLocalToUnit, IsDefinition,
1681
                                      StaticDataMemberDeclaration,
1682
-                                     templateParams, AlignInBits, nullptr));
1683
+                                     templateParams, Flags, AlignInBits, nullptr));
1684
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1685
                                      Line, Type, IsLocalToUnit, !IsDefinition,
1686
                                      StaticDataMemberDeclaration,
1687
-                                     templateParams, AlignInBits, nullptr));
1688
+                                     templateParams, Flags, AlignInBits, nullptr));
1689
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1690
                                      Line, Type, IsLocalToUnit, IsDefinition,
1691
                                      cast<DIDerivedType>(getDerivedType()),
1692
-                                     templateParams, AlignInBits, nullptr));
1693
+                                     templateParams, Flags, AlignInBits, nullptr));
1694
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1695
                                      Line, Type, IsLocalToUnit, IsDefinition,
1696
                                      StaticDataMemberDeclaration, nullptr,
1697
+                                     Flags, AlignInBits, nullptr));
1698
+  EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1699
+                                     Line, Type, IsLocalToUnit, IsDefinition,
1700
+                                     StaticDataMemberDeclaration,
1701
+                                     templateParams,
1702
+                                     static_cast<DINode::DIFlags>(Flags + 1),
1703
                                      AlignInBits, nullptr));
1704
   EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
1705
                                      Line, Type, IsLocalToUnit, IsDefinition,
1706
                                      StaticDataMemberDeclaration,
1707
-                                     templateParams, (AlignInBits << 1),
1708
+                                     templateParams, Flags, (AlignInBits << 1),
1709
                                      nullptr));
1710
 
1711
   TempDIGlobalVariable Temp = N->clone();
1712
@@ -2987,16 +2997,17 @@ TEST_F(DIGlobalVariableExpressionTest, get) {
1713
   auto *Expr2 = DIExpression::get(Context, {1, 2, 3});
1714
   DIDerivedType *StaticDataMemberDeclaration =
1715
       cast<DIDerivedType>(getDerivedType());
1716
+  DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
1717
   uint32_t AlignInBits = 8;
1718
 
1719
   auto *Var = DIGlobalVariable::get(
1720
       Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
1721
-      IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits,
1722
-      nullptr);
1723
+      IsDefinition, StaticDataMemberDeclaration, templateParams, Flags,
1724
+      AlignInBits, nullptr);
1725
   auto *Var2 = DIGlobalVariable::get(
1726
       Context, Scope, "other", LinkageName, File, Line, Type, IsLocalToUnit,
1727
-      IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits,
1728
-      nullptr);
1729
+      IsDefinition, StaticDataMemberDeclaration, templateParams, Flags,
1730
+      AlignInBits, nullptr);
1731
   auto *N = DIGlobalVariableExpression::get(Context, Var, Expr);
1732
 
1733
   EXPECT_EQ(Var, N->getVariable());
1734
diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py
1735
index 76fd66502009..399b74c4f00d 100644
1736
--- a/llvm/utils/lit/lit/TestingConfig.py
1737
+++ b/llvm/utils/lit/lit/TestingConfig.py
1738
@@ -26,6 +26,7 @@ class TestingConfig(object):
1739
             "SYSTEMROOT",
1740
             "TERM",
1741
             "CLANG",
1742
+            "FLANG",
1743
             "LLDB",
1744
             "LD_PRELOAD",
1745
             "LLVM_SYMBOLIZER_PATH",
1746
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
1747
index 16cc2968034b..d8dec6160071 100644
1748
--- a/llvm/utils/lit/lit/llvm/config.py
1749
+++ b/llvm/utils/lit/lit/llvm/config.py
1750
@@ -500,6 +500,8 @@ class LLVMConfig(object):
1751
         just-built or optionally an installed clang, and add a set of standard
1752
         substitutions useful to any test suite that makes use of clang.
1753
 
1754
+        Also sets up use of flang
1755
+
1756
         """
1757
         # Clear some environment variables that might affect Clang.
1758
         #
1759
@@ -631,6 +633,14 @@ class LLVMConfig(object):
1760
             self.add_tool_substitutions(tool_substitutions)
1761
             self.config.substitutions.append(("%resource_dir", builtin_include_dir))
1762
 
1763
+        self.config.flang = self.use_llvm_tool(
1764
+            'flang', search_env='FLANG', required=required)
1765
+        if self.config.flang:
1766
+            tool_substitutions = [
1767
+                ToolSubst('%flang', command=self.config.flang)
1768
+                ]
1769
+            self.add_tool_substitutions(tool_substitutions)
1770
+
1771
         self.config.substitutions.append(
1772
             (
1773
                 "%itanium_abi_triple",
1774
-- 
1775
2.24.3 (Apple Git-128)
1776
1777