forked from OSchip/llvm-project
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) llvm-svn: 330669
This commit is contained in:
parent
1bcb258ba3
commit
a27771b62f
|
@ -1,3 +1,4 @@
|
|||
#include "../include/KaleidoscopeJIT.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
|
@ -12,9 +13,9 @@
|
|||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Scalar/GVN.h"
|
||||
#include "../include/KaleidoscopeJIT.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "../include/KaleidoscopeJIT.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
@ -13,9 +14,9 @@
|
|||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Scalar/GVN.h"
|
||||
#include "../include/KaleidoscopeJIT.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include "../include/KaleidoscopeJIT.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
|
@ -13,9 +14,9 @@
|
|||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Scalar/GVN.h"
|
||||
#include "../include/KaleidoscopeJIT.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Support/TargetSelect.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Scalar/GVN.h"
|
||||
#include "llvm/Transforms/Utils.h"
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* 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/Types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsInstCombine Instruction Combining transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createInstructionCombiningPass function. */
|
||||
void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#endif
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Transforms/IPO/AlwaysInliner.h"
|
||||
#include "llvm/Transforms/IPO/FunctionAttrs.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include "llvm/Transforms/Instrumentation/BoundsChecking.h"
|
||||
#include "llvm/Transforms/ObjCARC.h"
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
///
|
||||
/// This file provides the primary interface to the instcombine pass. This pass
|
||||
/// is suitable for use in the new pass manager. For a pass that works with the
|
||||
/// legacy pass manager, please look for \c createInstructionCombiningPass() in
|
||||
/// Scalar.h.
|
||||
/// legacy pass manager, use \c createInstructionCombiningPass().
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -56,6 +55,20 @@ public:
|
|||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
bool runOnFunction(Function &F) override;
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// InstructionCombining - Combine instructions to form fewer, simple
|
||||
// instructions. This pass does not modify the CFG, and has a tendency to make
|
||||
// instructions dead, so a subsequent DCE pass is useful.
|
||||
//
|
||||
// This pass combines things like:
|
||||
// %Y = add int 1, %X
|
||||
// %Z = add int 1, %Y
|
||||
// into:
|
||||
// %Z = add int 2, %X
|
||||
//
|
||||
FunctionPass *createInstructionCombiningPass(bool ExpensiveCombines = true);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -126,20 +126,6 @@ Pass *createInductiveRangeCheckEliminationPass();
|
|||
//
|
||||
Pass *createIndVarSimplifyPass();
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// InstructionCombining - Combine instructions to form fewer, simple
|
||||
// instructions. This pass does not modify the CFG, and has a tendency to make
|
||||
// instructions dead, so a subsequent DCE pass is useful.
|
||||
//
|
||||
// This pass combines things like:
|
||||
// %Y = add int 1, %X
|
||||
// %Z = add int 1, %Y
|
||||
// into:
|
||||
// %Z = add int 2, %X
|
||||
//
|
||||
FunctionPass *createInstructionCombiningPass(bool ExpensiveCombines = true);
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// AggressiveInstCombiner - Combine expression patterns to form expressions with
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "llvm/Transforms/IPO/ForceFunctionAttrs.h"
|
||||
#include "llvm/Transforms/IPO/FunctionAttrs.h"
|
||||
#include "llvm/Transforms/IPO/InferFunctionAttrs.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Scalar/GVN.h"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#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"
|
||||
|
@ -74,6 +75,7 @@
|
|||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include "llvm/IR/LegacyPassManager.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
|
@ -95,7 +97,6 @@
|
|||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombine.h"
|
||||
#include "llvm/Transforms/InstCombine/InstCombineWorklist.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
@ -3367,3 +3368,7 @@ void LLVMInitializeInstCombine(LLVMPassRegistryRef R) {
|
|||
FunctionPass *llvm::createInstructionCombiningPass(bool ExpensiveCombines) {
|
||||
return new InstructionCombiningPass(ExpensiveCombines);
|
||||
}
|
||||
|
||||
void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createInstructionCombiningPass());
|
||||
}
|
||||
|
|
|
@ -154,10 +154,6 @@ void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM) {
|
|||
unwrap(PM)->add(createIndVarSimplifyPass());
|
||||
}
|
||||
|
||||
void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createInstructionCombiningPass());
|
||||
}
|
||||
|
||||
void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createJumpThreadingPass());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue