llvm.org GIT mirror llvm / b5b7fce
InstCombine: Fix layering by not including Scalar.h in InstCombine (notionally Scalar.h is part of libLLVMScalarOpts, so it shouldn't be included by InstCombine which doesn't/shouldn't need to depend on ScalarOpts) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330669 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 1 year, 2 months ago
11 changed file(s) with 75 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
0 #include "../include/KaleidoscopeJIT.h"
1 #include "llvm/ADT/APFloat.h"
12 #include "llvm/ADT/STLExtras.h"
23 #include "llvm/IR/BasicBlock.h"
1112 #include "llvm/IR/Verifier.h"
1213 #include "llvm/Support/TargetSelect.h"
1314 #include "llvm/Target/TargetMachine.h"
15 #include "llvm/Transforms/InstCombine/InstCombine.h"
1416 #include "llvm/Transforms/Scalar.h"
1517 #include "llvm/Transforms/Scalar/GVN.h"
16 #include "../include/KaleidoscopeJIT.h"
1718 #include
1819 #include
1920 #include
0 #include "../include/KaleidoscopeJIT.h"
1 #include "llvm/ADT/APFloat.h"
12 #include "llvm/ADT/STLExtras.h"
23 #include "llvm/IR/BasicBlock.h"
34 #include "llvm/IR/Constants.h"
45 #include "llvm/IR/DerivedTypes.h"
56 #include "llvm/IR/Function.h"
7 #include "llvm/IR/IRBuilder.h"
68 #include "llvm/IR/Instructions.h"
7 #include "llvm/IR/IRBuilder.h"
89 #include "llvm/IR/LLVMContext.h"
910 #include "llvm/IR/LegacyPassManager.h"
1011 #include "llvm/IR/Module.h"
1213 #include "llvm/IR/Verifier.h"
1314 #include "llvm/Support/TargetSelect.h"
1415 #include "llvm/Target/TargetMachine.h"
16 #include "llvm/Transforms/InstCombine/InstCombine.h"
1517 #include "llvm/Transforms/Scalar.h"
1618 #include "llvm/Transforms/Scalar/GVN.h"
17 #include "../include/KaleidoscopeJIT.h"
1819 #include
1920 #include
2021 #include
0 #include "../include/KaleidoscopeJIT.h"
1 #include "llvm/ADT/APFloat.h"
12 #include "llvm/ADT/STLExtras.h"
23 #include "llvm/IR/BasicBlock.h"
34 #include "llvm/IR/Constants.h"
45 #include "llvm/IR/DerivedTypes.h"
56 #include "llvm/IR/Function.h"
7 #include "llvm/IR/IRBuilder.h"
68 #include "llvm/IR/Instructions.h"
7 #include "llvm/IR/IRBuilder.h"
89 #include "llvm/IR/LLVMContext.h"
910 #include "llvm/IR/LegacyPassManager.h"
1011 #include "llvm/IR/Module.h"
1213 #include "llvm/IR/Verifier.h"
1314 #include "llvm/Support/TargetSelect.h"
1415 #include "llvm/Target/TargetMachine.h"
16 #include "llvm/Transforms/InstCombine/InstCombine.h"
1517 #include "llvm/Transforms/Scalar.h"
1618 #include "llvm/Transforms/Scalar/GVN.h"
17 #include "../include/KaleidoscopeJIT.h"
1819 #include
1920 #include
2021 #include
1313 #include "llvm/IR/Verifier.h"
1414 #include "llvm/Support/TargetSelect.h"
1515 #include "llvm/Target/TargetMachine.h"
16 #include "llvm/Transforms/InstCombine/InstCombine.h"
1617 #include "llvm/Transforms/Scalar.h"
1718 #include "llvm/Transforms/Scalar/GVN.h"
1819 #include "llvm/Transforms/Utils.h"
4141 #include "llvm/Transforms/IPO.h"
4242 #include "llvm/Transforms/IPO/AlwaysInliner.h"
4343 #include "llvm/Transforms/IPO/FunctionAttrs.h"
44 #include "llvm/Transforms/InstCombine/InstCombine.h"
4445 #include "llvm/Transforms/Instrumentation.h"
4546 #include "llvm/Transforms/Instrumentation/BoundsChecking.h"
4647 #include "llvm/Transforms/ObjCARC.h"
99 ///
1010 /// This file provides the primary interface to the instcombine pass. This pass
1111 /// is suitable for use in the new pass manager. For a pass that works with the
12 /// legacy pass manager, please look for \c createInstructionCombiningPass() in
13 /// Scalar.h.
12 /// legacy pass manager, use \c createInstructionCombiningPass().
1413 ///
1514 //===----------------------------------------------------------------------===//
1615
5554 void getAnalysisUsage(AnalysisUsage &AU) const override;
5655 bool runOnFunction(Function &F) override;
5756 };
57
58 //===----------------------------------------------------------------------===//
59 //
60 // InstructionCombining - Combine instructions to form fewer, simple
61 // instructions. This pass does not modify the CFG, and has a tendency to make
62 // instructions dead, so a subsequent DCE pass is useful.
63 //
64 // This pass combines things like:
65 // %Y = add int 1, %X
66 // %Z = add int 1, %Y
67 // into:
68 // %Z = add int 2, %X
69 //
70 FunctionPass *createInstructionCombiningPass(bool ExpensiveCombines = true);
5871 }
5972
6073 #endif
127127
128128 //===----------------------------------------------------------------------===//
129129 //
130 // InstructionCombining - Combine instructions to form fewer, simple
131 // instructions. This pass does not modify the CFG, and has a tendency to make
132 // instructions dead, so a subsequent DCE pass is useful.
133 //
134 // This pass combines things like:
135 // %Y = add int 1, %X
136 // %Z = add int 1, %Y
137 // into:
138 // %Z = add int 2, %X
139 //
140 FunctionPass *createInstructionCombiningPass(bool ExpensiveCombines = true);
141
142 //===----------------------------------------------------------------------===//
143 //
144130 // AggressiveInstCombiner - Combine expression patterns to form expressions with
145131 // fewer, simple instructions. This pass does not modify the CFG.
146132 //
0 /*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
1 |* *|
2 |* The LLVM Compiler Infrastructure *|
3 |* *|
4 |* This file is distributed under the University of Illinois Open Source *|
5 |* License. See LICENSE.TXT for details. *|
6 |* *|
7 |*===----------------------------------------------------------------------===*|
8 |* *|
9 |* This header declares the C interface to libLLVMInstCombine.a, which *|
10 |* combines instructions to form fewer, simple IR instructions. *|
11 |* *|
12 \*===----------------------------------------------------------------------===*/
13
14 #ifndef LLVM_C_TRANSFORMS_INSTCOMBINE_H
15 #define LLVM_C_TRANSFORMS_INSTCOMBINE_H
16
17 #include "llvm-c/Types.h"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /**
24 * @defgroup LLVMCTransformsInstCombine Instruction Combining transformations
25 * @ingroup LLVMCTransforms
26 *
27 * @{
28 */
29
30 /** See llvm::createInstructionCombiningPass function. */
31 void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);
32
33 /**
34 * @}
35 */
36
37 #ifdef __cplusplus
38 }
39 #endif /* defined(__cplusplus) */
40
41 #endif
42
3232 #include "llvm/Transforms/IPO/ForceFunctionAttrs.h"
3333 #include "llvm/Transforms/IPO/FunctionAttrs.h"
3434 #include "llvm/Transforms/IPO/InferFunctionAttrs.h"
35 #include "llvm/Transforms/InstCombine/InstCombine.h"
3536 #include "llvm/Transforms/Instrumentation.h"
3637 #include "llvm/Transforms/Scalar.h"
3738 #include "llvm/Transforms/Scalar/GVN.h"
3434
3535 #include "InstCombineInternal.h"
3636 #include "llvm-c/Initialization.h"
37 #include "llvm-c/Transforms/InstCombine.h"
3738 #include "llvm/ADT/APInt.h"
3839 #include "llvm/ADT/ArrayRef.h"
3940 #include "llvm/ADT/DenseMap.h"
7374 #include "llvm/IR/Instructions.h"
7475 #include "llvm/IR/IntrinsicInst.h"
7576 #include "llvm/IR/Intrinsics.h"
77 #include "llvm/IR/LegacyPassManager.h"
7678 #include "llvm/IR/Metadata.h"
7779 #include "llvm/IR/Operator.h"
7880 #include "llvm/IR/PassManager.h"
9496 #include "llvm/Support/raw_ostream.h"
9597 #include "llvm/Transforms/InstCombine/InstCombine.h"
9698 #include "llvm/Transforms/InstCombine/InstCombineWorklist.h"
97 #include "llvm/Transforms/Scalar.h"
9899 #include
99100 #include
100101 #include
33663367 FunctionPass *llvm::createInstructionCombiningPass(bool ExpensiveCombines) {
33673368 return new InstructionCombiningPass(ExpensiveCombines);
33683369 }
3370
3371 void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) {
3372 unwrap(PM)->add(createInstructionCombiningPass());
3373 }
153153 unwrap(PM)->add(createIndVarSimplifyPass());
154154 }
155155
156 void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) {
157 unwrap(PM)->add(createInstructionCombiningPass());
158 }
159
160156 void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM) {
161157 unwrap(PM)->add(createJumpThreadingPass());
162158 }