P4 to Git Change 1281101 by smekhano@stas-rampitec-hsa on 2016/06/17 13:42:09

SWDEV-95698 - Complib: set data layout string from the subtarget in codegen
	This logic was broken since llvm 3.6 merge and datalayout was not set as supposed.
	This results in a different compilation results with complib and llc.
	In addition that leads to the suboptimal codegen.

	Testing: smoke, precheckin, llc_opt, ocl_features, vec_ldst, ocl_sdk_aoc2_compare_main
	Reviewed by Evgeny Mankov

Affected files ...

... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/codegen.cpp#71 edit
... //depot/stg/opencl/drivers/opencl/tests/hsa/src/ocl/regression/95698/calcweight-nounroll-min.cl#1 add
... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/ocl_regression.tlst#37 edit
Tento commit je obsažen v:
foreman
2016-06-17 13:49:36 -04:00
rodič 90d81a61cc
revize 2300414425
+4 -8
Zobrazit soubor
@@ -32,6 +32,7 @@
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/MCJIT.h"
#include <iostream>
@@ -555,15 +556,10 @@ llvmCodeGen(
// Basic Block.
PassManager Passes;
// Add the target data from the target machine, if it exists, or the module.
#if defined(LEGACY_COMPLIB)
if (const DataLayout *TD = Target.getDataLayout())
Passes.add(new DataLayout(*TD));
else
Passes.add(new DataLayout(&mod));
#else
// Add the target data from the target machine, if it exists.
if (const DataLayout *TD = Target.getSubtargetImpl()->getDataLayout())
mod.setDataLayout(TD);
Passes.add(new DataLayoutPass());
#endif
// Override default to generate verbose assembly, if the device is not the GPU.
// The GPU sets this in AMDILTargetMachine.cpp.