P4 to Git Change 1293547 by smekhano@stas-rampitec-hsa on 2016/07/20 11:43:35

SWDEV-97737 - Complib: fix unrolling preferences on the online path
	The TargetTransformInfo needs to be added to pass manager before other passes now.
	Otherwise the first pass which requires this analysis will create a default TTI on initialization
	and when real HSAILTTIImpl will be added to PM, PM->add() will silently delete this new analysis pass
	on the basis that a pass with such ID already exists in the pass manager.
	That is in fact concern for all analysis passes.

	Testing: smoke, precheckin, LDSReadSpeed
	Reviewed by Daniil Fukalov

Affected files ...

... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/opt_level.cpp#32 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/opt_level.hpp#6 edit
This commit is contained in:
foreman
2016-07-20 12:20:58 -04:00
parent e1a1da0a49
commit a46f607eb0
2 changed files with 75 additions and 78 deletions
@@ -11,12 +11,10 @@
#undef DEBUG
#endif
#if defined(LEGACY_COMPLIB)
#include "llvm/PassManager.h"
#else
#include "llvm/IR/LegacyPassManager.h"
#endif
#include "llvm/Analysis/Passes.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Target/TargetMachine.h"
namespace llvm {
class Module;
@@ -42,13 +40,13 @@ namespace amdcl
public:
OptLevel(amd::option::Options *OptionsObj)
: opts_(OptionsObj) {}
: opts_(OptionsObj), TM(nullptr) {}
virtual ~OptLevel() {}
virtual ~OptLevel() { delete TM; }
virtual int optimize(aclBinary *elf, llvm::Module *input, bool isGPU) = 0;
protected:
void setup(bool isGPU, uint32_t OptLevel);
void setup(aclBinary *elf, bool isGPU, uint32_t OptLevel);
void run(aclBinary *elf);
LLVM_LEGACY_NAMESPACE::PassManager& Passes() { return passes_; }
LLVM_LEGACY_NAMESPACE::FunctionPassManager& FPasses() { return (*fpasses_); }
@@ -58,6 +56,7 @@ namespace amdcl
LLVM_LEGACY_NAMESPACE::FunctionPassManager *fpasses_;
LLVM_LEGACY_NAMESPACE::PassManager passes_;
amd::option::Options *opts_;
llvm::TargetMachine* TM;
}; // class OptLevel
/*@}*/