2121#include " llvm/ADT/STLExtras.h"
2222#include " llvm/ADT/SmallVector.h"
2323#include " llvm/Analysis/TargetTransformInfo.h"
24+ #include " llvm/Config/llvm-config.h"
2425#include " llvm/ExecutionEngine/ExecutionEngine.h"
2526#include " llvm/IR/IRBuilder.h"
2627#include " llvm/IR/LegacyPassManager.h"
4243#include " tc/core/polyhedral/scop.h"
4344#include " tc/core/scope_guard.h"
4445
46+ #ifndef LLVM_VERSION_MAJOR
47+ #error LLVM_VERSION_MAJOR not set
48+ #endif
49+
4550using namespace Halide ;
4651
4752namespace tc {
@@ -303,8 +308,8 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 {
303308 Halide::Internal::debug (3 ) << " Optimizing module\n " ;
304309
305310 if (Halide::Internal::debug::debug_level () >= 3 ) {
306- #if LLVM_VERSION >= 50
307- module ->print (dbgs (), nullptr , false , true );
311+ #if LLVM_VERSION_MAJOR >= 5
312+ module ->print (llvm:: dbgs (), nullptr , false , true );
308313 #else
309314 module ->dump ();
310315 #endif
@@ -338,16 +343,16 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 {
338343
339344 llvm::PassManagerBuilder b;
340345 b.OptLevel = 3 ;
341- b.tapirTarget = new llvm::tapir:: CilkABI ();
342- #if LLVM_VERSION >= 50
346+ b.tapirTarget = new llvm::CilkABI ();
347+ #if LLVM_VERSION_MAJOR >= 5
343348 b.Inliner = llvm::createFunctionInliningPass (b.OptLevel , 0 , false );
344349#else
345350 b.Inliner = llvm::createFunctionInliningPass (b.OptLevel , 0 );
346351#endif
347352 b.LoopVectorize = true ;
348353 b.SLPVectorize = true ;
349354
350- #if LLVM_VERSION >= 50
355+ #if LLVM_VERSION_MAJOR >= 5
351356 if (TM) {
352357 TM->adjustPassManager (b);
353358 }
@@ -366,8 +371,8 @@ class CodeGen_TC : public Halide::Internal::CodeGen_X86 {
366371
367372 Halide::Internal::debug (3 ) << " After LLVM optimizations:\n " ;
368373 if (Halide::Internal::debug::debug_level () >= 2 ) {
369- #if LLVM_VERSION >= 50
370- module ->print (dbgs (), nullptr , false , true );
374+ #if LLVM_VERSION_MAJOR >= 5
375+ module ->print (llvm:: dbgs (), nullptr , false , true );
371376 #else
372377 module ->dump ();
373378 #endif
@@ -530,7 +535,8 @@ class LLVMCodegen {
530535 llvm::BasicBlock::Create (llvmCtx, " loop_latch" , function);
531536 auto * loopExitBB = llvm::BasicBlock::Create (llvmCtx, " loop_exit" , function);
532537
533- bool parallel = true ;
538+ // TODO: integrate query ISL as to whether the relevant loop ought be parallelized
539+ bool parallel = false ;
534540
535541 llvm::Value* SyncRegion = nullptr ;
536542 if (parallel) {
0 commit comments