summarylogtreecommitdiffstats
path: root/0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch
blob: a9dfd87457cda8dbb53f9f6e5d4693e2e054a437 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
From f7ca01333214f934c580c162afdee933e7430b6c Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Tue, 28 Feb 2023 16:38:45 +0100
Subject: [PATCH] [llvm-c] Remove bindings for creating legacy passes

Legacy passes are only supported for codegen, and I don't believe
it's possible to write backends using the C API, so we should drop
all of those. Reduces the number of places that need to be modified
when removing legacy passes.

Differential Revision: https://reviews.llvm.org/D144970
---
 clang/docs/tools/clang-formatted-files.txt    |   2 -
 llvm/docs/ReleaseNotes.rst                    |   2 +
 llvm/include/llvm-c/Transforms/IPO.h          |  45 -----
 llvm/include/llvm-c/Transforms/InstCombine.h  |  40 -----
 llvm/include/llvm-c/Transforms/Scalar.h       | 152 -----------------
 llvm/include/llvm-c/Transforms/Utils.h        |  50 ------
 llvm/include/llvm-c/Transforms/Vectorize.h    |  47 ------
 llvm/lib/Transforms/IPO/IPO.cpp               |   9 -
 .../InstCombine/InstructionCombining.cpp      |   5 -
 llvm/lib/Transforms/Scalar/Scalar.cpp         | 158 ------------------
 llvm/lib/Transforms/Utils/Utils.cpp           |  13 --
 llvm/lib/Transforms/Vectorize/Vectorize.cpp   |   9 -
 llvm/tools/llvm-c-test/include-all.c          |   6 +-
 13 files changed, 3 insertions(+), 535 deletions(-)
 delete mode 100644 llvm/include/llvm-c/Transforms/IPO.h
 delete mode 100644 llvm/include/llvm-c/Transforms/InstCombine.h
 delete mode 100644 llvm/include/llvm-c/Transforms/Scalar.h
 delete mode 100644 llvm/include/llvm-c/Transforms/Utils.h
 delete mode 100644 llvm/include/llvm-c/Transforms/Vectorize.h

diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt
index 45970232d0c0..31d1dd7f365a 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -5713,8 +5713,6 @@ llvm/include/llvm-c/OrcEE.h
 llvm/include/llvm-c/Remarks.h
 llvm/include/llvm-c/Types.h
 llvm/include/llvm-c/Transforms/PassBuilder.h
-llvm/include/llvm-c/Transforms/Scalar.h
-llvm/include/llvm-c/Transforms/Vectorize.h
 llvm/lib/Analysis/CodeMetrics.cpp
 llvm/lib/Analysis/CycleAnalysis.cpp
 llvm/lib/Analysis/DDGPrinter.cpp
diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index ef7dacd82bf0..aed1df36b490 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -145,6 +145,8 @@ Changes to the C API
 
 * ``LLVMContextSetOpaquePointers``, a temporary API to pin to legacy typed
   pointer, has been removed.
+* Functions for adding legacy passes like ``LLVMAddInstructionCombiningPass``
+  have been removed.
 
 Changes to the FastISel infrastructure
 --------------------------------------
diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h
deleted file mode 100644
index c558aa37f1c3..000000000000
--- a/llvm/include/llvm-c/Transforms/IPO.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*===-- IPO.h - Interprocedural Transformations C Interface -----*- C++ -*-===*\
-|*                                                                            *|
-|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
-|* Exceptions.                                                                *|
-|* See https://llvm.org/LICENSE.txt for license information.                  *|
-|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
-|*                                                                            *|
-|*===----------------------------------------------------------------------===*|
-|*                                                                            *|
-|* This header declares the C interface to libLLVMIPO.a, which implements     *|
-|* various interprocedural transformations of the LLVM IR.                    *|
-|*                                                                            *|
-\*===----------------------------------------------------------------------===*/
-
-#ifndef LLVM_C_TRANSFORMS_IPO_H
-#define LLVM_C_TRANSFORMS_IPO_H
-
-#include "llvm-c/ExternC.h"
-#include "llvm-c/Types.h"
-
-LLVM_C_EXTERN_C_BEGIN
-
-/**
- * @defgroup LLVMCTransformsIPO Interprocedural transformations
- * @ingroup LLVMCTransforms
- *
- * @{
- */
-
-/** See llvm::createDeadArgEliminationPass function. */
-void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM);
-
-/** See llvm::createFunctionAttrsPass function. */
-void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM);
-
-/** See llvm::createAlwaysInlinerPass function. */
-void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM);
-
-/**
- * @}
- */
-
-LLVM_C_EXTERN_C_END
-
-#endif
diff --git a/llvm/include/llvm-c/Transforms/InstCombine.h b/llvm/include/llvm-c/Transforms/InstCombine.h
deleted file mode 100644
index ebe17d667061..000000000000
--- a/llvm/include/llvm-c/Transforms/InstCombine.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
-|*                                                                            *|
-|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
-|* Exceptions.                                                                *|
-|* See https://llvm.org/LICENSE.txt for license information.                  *|
-|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
-|*                                                                            *|
-|*===----------------------------------------------------------------------===*|
-|*                                                                            *|
-|* This header declares the C interface to libLLVMInstCombine.a, which        *|
-|* combines instructions to form fewer, simple IR instructions.               *|
-|*                                                                            *|
-\*===----------------------------------------------------------------------===*/
-
-#ifndef LLVM_C_TRANSFORMS_INSTCOMBINE_H
-#define LLVM_C_TRANSFORMS_INSTCOMBINE_H
-
-#include "llvm-c/ExternC.h"
-#include "llvm-c/Types.h"
-
-LLVM_C_EXTERN_C_BEGIN
-
-/**
- * @defgroup LLVMCTransformsInstCombine Instruction Combining transformations
- * @ingroup LLVMCTransforms
- *
- * @{
- */
-
-/** See llvm::createInstructionCombiningPass function. */
-void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);
-
-/**
- * @}
- */
-
-LLVM_C_EXTERN_C_END
-
-#endif
-
diff --git a/llvm/include/llvm-c/Transforms/Scalar.h b/llvm/include/llvm-c/Transforms/Scalar.h
deleted file mode 100644
index 8eefe7bec457..000000000000
--- a/llvm/include/llvm-c/Transforms/Scalar.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
-|*                                                                            *|
-|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
-|* Exceptions.                                                                *|
-|* See https://llvm.org/LICENSE.txt for license information.                  *|
-|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
-|*                                                                            *|
-|*===----------------------------------------------------------------------===*|
-|*                                                                            *|
-|* This header declares the C interface to libLLVMScalarOpts.a, which         *|
-|* implements various scalar transformations of the LLVM IR.                  *|
-|*                                                                            *|
-|* Many exotic languages can interoperate with C code but have a harder time  *|
-|* with C++ due to name mangling. So in addition to C, this interface enables *|
-|* tools written in such languages.                                           *|
-|*                                                                            *|
-\*===----------------------------------------------------------------------===*/
-
-#ifndef LLVM_C_TRANSFORMS_SCALAR_H
-#define LLVM_C_TRANSFORMS_SCALAR_H
-
-#include "llvm-c/ExternC.h"
-#include "llvm-c/Types.h"
-
-LLVM_C_EXTERN_C_BEGIN
-
-/**
- * @defgroup LLVMCTransformsScalar Scalar transformations
- * @ingroup LLVMCTransforms
- *
- * @{
- */
-
-/** See llvm::createAggressiveDCEPass function. */
-void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM);
-
-/** See llvm::createDeadCodeEliminationPass function. */
-void LLVMAddDCEPass(LLVMPassManagerRef PM);
-
-/** See llvm::createBitTrackingDCEPass function. */
-void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM);
-
-/** See llvm::createAlignmentFromAssumptionsPass function. */
-void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM);
-
-/** See llvm::createCFGSimplificationPass function. */
-void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM);
-
-/** See llvm::createDeadStoreEliminationPass function. */
-void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM);
-
-/** See llvm::createScalarizerPass function. */
-void LLVMAddScalarizerPass(LLVMPassManagerRef PM);
-
-/** See llvm::createMergedLoadStoreMotionPass function. */
-void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM);
-
-/** See llvm::createGVNPass function. */
-void LLVMAddGVNPass(LLVMPassManagerRef PM);
-
-/** See llvm::createGVNPass function. */
-void LLVMAddNewGVNPass(LLVMPassManagerRef PM);
-
-/** See llvm::createIndVarSimplifyPass function. */
-void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM);
-
-/** See llvm::createInstructionCombiningPass function. */
-void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);
-
-/** See llvm::createInstSimplifyLegacyPass function. */
-void LLVMAddInstructionSimplifyPass(LLVMPassManagerRef PM);
-
-/** See llvm::createJumpThreadingPass function. */
-void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM);
-
-/** See llvm::createLICMPass function. */
-void LLVMAddLICMPass(LLVMPassManagerRef PM);
-
-/** See llvm::createLoopRotatePass function. */
-void LLVMAddLoopRotatePass(LLVMPassManagerRef PM);
-
-/** See llvm::createLoopUnrollPass function. */
-void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM);
-
-/** See llvm::createLowerAtomicPass function. */
-void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM);
-
-/** See llvm::createMemCpyOptPass function. */
-void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM);
-
-/** See llvm::createPartiallyInlineLibCallsPass function. */
-void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM);
-
-/** See llvm::createReassociatePass function. */
-void LLVMAddReassociatePass(LLVMPassManagerRef PM);
-
-/** See llvm::createSROAPass function. */
-void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM);
-
-/** See llvm::createSROAPass function. */
-void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM);
-
-/** See llvm::createSROAPass function. */
-void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,
-                                                  int Threshold);
-
-/** See llvm::createSimplifyLibCallsPass function. */
-void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM);
-
-/** See llvm::createTailCallEliminationPass function. */
-void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM);
-
-/** See llvm::demotePromoteMemoryToRegisterPass function. */
-void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM);
-
-/** See llvm::createVerifierPass function. */
-void LLVMAddVerifierPass(LLVMPassManagerRef PM);
-
-/** See llvm::createCorrelatedValuePropagationPass function */
-void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM);
-
-/** See llvm::createEarlyCSEPass function */
-void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM);
-
-/** See llvm::createEarlyCSEPass function */
-void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM);
-
-/** See llvm::createLowerExpectIntrinsicPass function */
-void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM);
-
-/** See llvm::createLowerConstantIntrinsicsPass function */
-void LLVMAddLowerConstantIntrinsicsPass(LLVMPassManagerRef PM);
-
-/** See llvm::createTypeBasedAliasAnalysisPass function */
-void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM);
-
-/** See llvm::createScopedNoAliasAAPass function */
-void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM);
-
-/** See llvm::createBasicAliasAnalysisPass function */
-void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM);
-
-/** See llvm::createUnifyFunctionExitNodesPass function */
-void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM);
-
-/**
- * @}
- */
-
-LLVM_C_EXTERN_C_END
-
-#endif
diff --git a/llvm/include/llvm-c/Transforms/Utils.h b/llvm/include/llvm-c/Transforms/Utils.h
deleted file mode 100644
index 30d1ae63de1d..000000000000
--- a/llvm/include/llvm-c/Transforms/Utils.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*===-- Utils.h - Transformation Utils Library C Interface ------*- C++ -*-===*\
-|*                                                                            *|
-|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
-|* Exceptions.                                                                *|
-|* See https://llvm.org/LICENSE.txt for license information.                  *|
-|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
-|*                                                                            *|
-|*===----------------------------------------------------------------------===*|
-|*                                                                            *|
-|* This header declares the C interface to libLLVMTransformUtils.a, which     *|
-|* implements various transformation utilities of the LLVM IR.                *|
-|*                                                                            *|
-|* Many exotic languages can interoperate with C code but have a harder time  *|
-|* with C++ due to name mangling. So in addition to C, this interface enables *|
-|* tools written in such languages.                                           *|
-|*                                                                            *|
-\*===----------------------------------------------------------------------===*/
-
-#ifndef LLVM_C_TRANSFORMS_UTILS_H
-#define LLVM_C_TRANSFORMS_UTILS_H
-
-#include "llvm-c/ExternC.h"
-#include "llvm-c/Types.h"
-
-LLVM_C_EXTERN_C_BEGIN
-
-/**
- * @defgroup LLVMCTransformsUtils Transformation Utilities
- * @ingroup LLVMCTransforms
- *
- * @{
- */
-
-/** See llvm::createLowerSwitchPass function. */
-void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM);
-
-/** See llvm::createPromoteMemoryToRegisterPass function. */
-void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM);
-
-/** See llvm::createAddDiscriminatorsPass function. */
-void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM);
-
-/**
- * @}
- */
-
-LLVM_C_EXTERN_C_END
-
-#endif
-
diff --git a/llvm/include/llvm-c/Transforms/Vectorize.h b/llvm/include/llvm-c/Transforms/Vectorize.h
deleted file mode 100644
index 0de458381399..000000000000
--- a/llvm/include/llvm-c/Transforms/Vectorize.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*===---------------------------Vectorize.h --------------------- -*- C -*-===*\
-|*===----------- Vectorization Transformation Library C Interface ---------===*|
-|*                                                                            *|
-|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
-|* Exceptions.                                                                *|
-|* See https://llvm.org/LICENSE.txt for license information.                  *|
-|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
-|*                                                                            *|
-|*===----------------------------------------------------------------------===*|
-|*                                                                            *|
-|* This header declares the C interface to libLLVMVectorize.a, which          *|
-|* implements various vectorization transformations of the LLVM IR.           *|
-|*                                                                            *|
-|* Many exotic languages can interoperate with C code but have a harder time  *|
-|* with C++ due to name mangling. So in addition to C, this interface enables *|
-|* tools written in such languages.                                           *|
-|*                                                                            *|
-\*===----------------------------------------------------------------------===*/
-
-#ifndef LLVM_C_TRANSFORMS_VECTORIZE_H
-#define LLVM_C_TRANSFORMS_VECTORIZE_H
-
-#include "llvm-c/ExternC.h"
-#include "llvm-c/Types.h"
-
-LLVM_C_EXTERN_C_BEGIN
-
-/**
- * @defgroup LLVMCTransformsVectorize Vectorization transformations
- * @ingroup LLVMCTransforms
- *
- * @{
- */
-
-/** See llvm::createLoopVectorizePass function. */
-void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM);
-
-/** See llvm::createSLPVectorizerPass function. */
-void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM);
-
-/**
- * @}
- */
-
-LLVM_C_EXTERN_C_END
-
-#endif
diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp
index eb0a91bbbc90..fcd58898c88b 100644
--- a/llvm/lib/Transforms/IPO/IPO.cpp
+++ b/llvm/lib/Transforms/IPO/IPO.cpp
@@ -12,7 +12,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm-c/Transforms/IPO.h"
 #include "llvm-c/Initialization.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/InitializePasses.h"
@@ -34,11 +33,3 @@ void llvm::initializeIPO(PassRegistry &Registry) {
 void LLVMInitializeIPO(LLVMPassRegistryRef R) {
   initializeIPO(*unwrap(R));
 }
-
-void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createDeadArgEliminationPass());
-}
-
-void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(llvm::createAlwaysInlinerLegacyPass());
-}
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 34d1b2b46db2..c3ba452e3341 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -34,7 +34,6 @@
 
 #include "InstCombineInternal.h"
 #include "llvm-c/Initialization.h"
-#include "llvm-c/Transforms/InstCombine.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
@@ -4760,7 +4759,3 @@ FunctionPass *llvm::createInstructionCombiningPass() {
 FunctionPass *llvm::createInstructionCombiningPass(unsigned MaxIterations) {
   return new InstructionCombiningPass(MaxIterations);
 }
-
-void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createInstructionCombiningPass());
-}
diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp
index c2b9350933d4..9a3d243859be 100644
--- a/llvm/lib/Transforms/Scalar/Scalar.cpp
+++ b/llvm/lib/Transforms/Scalar/Scalar.cpp
@@ -14,7 +14,6 @@
 
 #include "llvm/Transforms/Scalar.h"
 #include "llvm-c/Initialization.h"
-#include "llvm-c/Transforms/Scalar.h"
 #include "llvm/Analysis/BasicAliasAnalysis.h"
 #include "llvm/Analysis/ScopedNoAliasAA.h"
 #include "llvm/Analysis/TypeBasedAliasAnalysis.h"
@@ -97,163 +96,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) {
   initializeLoopSimplifyCFGLegacyPassPass(Registry);
 }
 
-void LLVMAddLoopSimplifyCFGPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLoopSimplifyCFGPass());
-}
-
 void LLVMInitializeScalarOpts(LLVMPassRegistryRef R) {
   initializeScalarOpts(*unwrap(R));
 }
-
-void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createAggressiveDCEPass());
-}
-
-void LLVMAddDCEPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createDeadCodeEliminationPass());
-}
-
-void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createBitTrackingDCEPass());
-}
-
-void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createAlignmentFromAssumptionsPass());
-}
-
-void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createCFGSimplificationPass());
-}
-
-void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createDeadStoreEliminationPass());
-}
-
-void LLVMAddScalarizerPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createScalarizerPass());
-}
-
-void LLVMAddGVNPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createGVNPass());
-}
-
-void LLVMAddNewGVNPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createNewGVNPass());
-}
-
-void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createMergedLoadStoreMotionPass());
-}
-
-void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createIndVarSimplifyPass());
-}
-
-void LLVMAddInstructionSimplifyPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createInstSimplifyLegacyPass());
-}
-
-void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createJumpThreadingPass());
-}
-
-void LLVMAddLoopSinkPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLoopSinkPass());
-}
-
-void LLVMAddLICMPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLICMPass());
-}
-
-void LLVMAddLoopRotatePass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLoopRotatePass());
-}
-
-void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLoopUnrollPass());
-}
-
-void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLowerAtomicPass());
-}
-
-void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createMemCpyOptPass());
-}
-
-void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createPartiallyInlineLibCallsPass());
-}
-
-void LLVMAddReassociatePass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createReassociatePass());
-}
-
-void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createSROAPass());
-}
-
-void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createSROAPass());
-}
-
-void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,
-                                                  int Threshold) {
-  unwrap(PM)->add(createSROAPass());
-}
-
-void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM) {
-  // NOTE: The simplify-libcalls pass has been removed.
-}
-
-void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createTailCallEliminationPass());
-}
-
-void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createDemoteRegisterToMemoryPass());
-}
-
-void LLVMAddVerifierPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createVerifierPass());
-}
-
-void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createCorrelatedValuePropagationPass());
-}
-
-void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createEarlyCSEPass(false/*=UseMemorySSA*/));
-}
-
-void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createEarlyCSEPass(true/*=UseMemorySSA*/));
-}
-
-void LLVMAddGVNHoistLegacyPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createGVNHoistPass());
-}
-
-void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createTypeBasedAAWrapperPass());
-}
-
-void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createScopedNoAliasAAWrapperPass());
-}
-
-void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createBasicAAWrapperPass());
-}
-
-void LLVMAddLowerConstantIntrinsicsPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLowerConstantIntrinsicsPass());
-}
-
-void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLowerExpectIntrinsicPass());
-}
-
-void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createUnifyFunctionExitNodesPass());
-}
diff --git a/llvm/lib/Transforms/Utils/Utils.cpp b/llvm/lib/Transforms/Utils/Utils.cpp
index a20dadb69767..d86f20c7bb6f 100644
--- a/llvm/lib/Transforms/Utils/Utils.cpp
+++ b/llvm/lib/Transforms/Utils/Utils.cpp
@@ -13,7 +13,6 @@
 
 #include "llvm/Transforms/Utils.h"
 #include "llvm-c/Initialization.h"
-#include "llvm-c/Transforms/Utils.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
@@ -50,15 +49,3 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) {
 void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) {
   initializeTransformUtils(*unwrap(R));
 }
-
-void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLowerSwitchPass());
-}
-
-void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createPromoteMemoryToRegisterPass());
-}
-
-void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createAddDiscriminatorsPass());
-}
diff --git a/llvm/lib/Transforms/Vectorize/Vectorize.cpp b/llvm/lib/Transforms/Vectorize/Vectorize.cpp
index c2060484af5d..6a335e9120bb 100644
--- a/llvm/lib/Transforms/Vectorize/Vectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/Vectorize.cpp
@@ -14,7 +14,6 @@
 
 #include "llvm/Transforms/Vectorize.h"
 #include "llvm-c/Initialization.h"
-#include "llvm-c/Transforms/Vectorize.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/PassRegistry.h"
@@ -31,11 +30,3 @@ void llvm::initializeVectorization(PassRegistry &Registry) {
 void LLVMInitializeVectorization(LLVMPassRegistryRef R) {
   initializeVectorization(*unwrap(R));
 }
-
-void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createLoopVectorizePass());
-}
-
-void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM) {
-  unwrap(PM)->add(createSLPVectorizerPass());
-}
diff --git a/llvm/tools/llvm-c-test/include-all.c b/llvm/tools/llvm-c-test/include-all.c
index 69ed753e5068..eada03caf5e0 100644
--- a/llvm/tools/llvm-c-test/include-all.c
+++ b/llvm/tools/llvm-c-test/include-all.c
@@ -35,11 +35,7 @@
 #include "llvm-c/Support.h"
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
-#include "llvm-c/Transforms/InstCombine.h"
-#include "llvm-c/Transforms/IPO.h"
+#include "llvm-c/Transforms/PassBuilder.h"
 #include "llvm-c/Transforms/PassManagerBuilder.h"
-#include "llvm-c/Transforms/Scalar.h"
-#include "llvm-c/Transforms/Utils.h"
-#include "llvm-c/Transforms/Vectorize.h"
 #include "llvm-c/Types.h"
 #include "llvm-c/lto.h"
-- 
2.39.2