diff --git a/lib/polygeist/Passes/AffineCFG.cpp b/lib/polygeist/Passes/AffineCFG.cpp index d6187d0..2c94485 100644 --- a/lib/polygeist/Passes/AffineCFG.cpp +++ b/lib/polygeist/Passes/AffineCFG.cpp @@ -1160,7 +1160,6 @@ void AffineCFGPass::runOnFunction() { applyPatternsAndFoldGreedily(getFunction().getOperation(), std::move(rpl), config); } - getFunction().dump(); } std::unique_ptr> mlir::polygeist::replaceAffineCFGPass() { diff --git a/llvm-project b/llvm-project index 5616a79..e9a3637 160000 --- a/llvm-project +++ b/llvm-project @@ -1 +1 @@ -Subproject commit 5616a79398c7f10d92daf7d6387b195e95f2ac7e +Subproject commit e9a3637c0ca4772aeee55cd09d98a68b19e18621 diff --git a/mlir-clang/Lib/clang-mlir.cc b/mlir-clang/Lib/clang-mlir.cc index e0672f0..a94f336 100644 --- a/mlir-clang/Lib/clang-mlir.cc +++ b/mlir-clang/Lib/clang-mlir.cc @@ -2973,8 +2973,6 @@ static bool parseMLIR(const char *Argv0, std::vector filenames, Clang->getHeaderSearchOpts().ResourceDir.size() == 0) Clang->getHeaderSearchOpts().ResourceDir = CompilerInvocation::GetResourcesPath(Argv0, GetExecutablePathVP); - - llvm::errs() << " resourcedir: " << Clang->getHeaderSearchOpts().ResourceDir << "\n"; //} Clang->getInvocation().getFrontendOpts().DisableFree = false; diff --git a/mlir-clang/Lib/clang-mlir.h b/mlir-clang/Lib/clang-mlir.h index 8bad13b..31733b2 100644 --- a/mlir-clang/Lib/clang-mlir.h +++ b/mlir-clang/Lib/clang-mlir.h @@ -19,7 +19,8 @@ #include "mlir/IR/MLIRContext.h" #include "mlir/IR/OpDefinition.h" #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" -#include "mlir/Target/LLVMIR/TypeTranslation.h" +#include "mlir/Target/LLVMIR/TypeFromLLVM.h" +#include "mlir/Target/LLVMIR/TypeToLLVM.h" #include "llvm/IR/DerivedTypes.h" #include "polygeist/Ops.h" diff --git a/mlir-clang/Test/Verification/fscanf.c b/mlir-clang/Test/Verification/fscanf.c index 34bd298..5932971 100644 --- a/mlir-clang/Test/Verification/fscanf.c +++ b/mlir-clang/Test/Verification/fscanf.c @@ -1,4 +1,4 @@ -// RUN: mlir-clang %s | FileCheck %s +// RUN: mlir-clang %s %stdinclude | FileCheck %s #include #include diff --git a/mlir-clang/Test/Verification/malloc.c b/mlir-clang/Test/Verification/malloc.c index ecab6ab..d0aa0ac 100644 --- a/mlir-clang/Test/Verification/malloc.c +++ b/mlir-clang/Test/Verification/malloc.c @@ -1,4 +1,4 @@ -// RUN: mlir-clang %s --function=caller | FileCheck %s +// RUN: mlir-clang %s --function=caller %stdinclude | FileCheck %s #include diff --git a/mlir-clang/Test/Verification/snus.c b/mlir-clang/Test/Verification/snus.c new file mode 100644 index 0000000..9fd3c39 --- /dev/null +++ b/mlir-clang/Test/Verification/snus.c @@ -0,0 +1,18 @@ +// RUN: mlir-clang %s -detect-reduction --function=kernel_nussinov | FileCheck %s + +#define max_score(s1, s2) ((s1 >= s2) ? s1 : s2) + +void kernel_nussinov(int n, double table[20][60]) { + int i, j, k; + +#pragma scop + i =0; +// for (j=i+1; j<_PB_N; j++) { + j = 0; + for (k=0; k %s.out1 -// RUN: mlir-clang %s %polyverify %stdinclude -detect-reduction -emit-llvm | clang -x ir - -O3 -o %s.execm && %s.execm &> %s.out2 +// RUN: mlir-clang %s %polyverify %stdinclude -detect-reduction -emit-llvm | clang -x ir - -O3 -o %s.execm -lm && %s.execm &> %s.out2 // RUN: rm -f %s.exec1 %s.execm // RUN: diff %s.out1 %s.out2 // RUN: rm -f %s.out1 %s.out2 diff --git a/mlir-clang/mlir-clang.cc b/mlir-clang/mlir-clang.cc index 547fe8e..0c9b1f5 100644 --- a/mlir-clang/mlir-clang.cc +++ b/mlir-clang/mlir-clang.cc @@ -157,8 +157,6 @@ int main(int argc, char **argv) { optPM.addPass(polygeist::createRaiseSCFToAffinePass()); optPM.addPass(polygeist::replaceAffineCFGPass()); } - if (DetectReduction) - optPM.addPass(polygeist::detectReductionPass()); if (mlir::failed(pm.run(module))) { module.dump(); return 4; @@ -167,12 +165,15 @@ int main(int argc, char **argv) { module.dump(); return 5; } - + module.dump(); #define optPM optPM2 #define pm pm2 mlir::PassManager pm(&context); mlir::OpPassManager &optPM = pm.nest(); + if (DetectReduction) + optPM.addPass(polygeist::detectReductionPass()); + optPM.addPass(mlir::createCanonicalizerPass()); optPM.addPass(mlir::createCSEPass()); optPM.addPass(mlir::createCanonicalizerPass());