From 110fb111e26a655a86fab6f774735eedbf67d972 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 29 May 2019 13:01:03 -0400 Subject: [PATCH 1/2] add missing testhelpers/llvmpasses.jl file --- test/testhelpers/llvmpasses.jl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/testhelpers/llvmpasses.jl diff --git a/test/testhelpers/llvmpasses.jl b/test/testhelpers/llvmpasses.jl new file mode 100644 index 0000000000000..09f152a064475 --- /dev/null +++ b/test/testhelpers/llvmpasses.jl @@ -0,0 +1,25 @@ +using InteractiveUtils +using Printf + +# get a temporary directory +dir = ARGS[1] +rm(dir, force=true, recursive=true) +mkdir(dir) + +# toggle between unoptimized (CHECK/LOWER) and optimized IR (FINAL). +optimize=false +if length(ARGS) >= 2 + optimize = ARGS[2]=="-O" +end + +# Emit LLVM IR to dir +counter = 0 +function emit(f, tt...) + global counter + name = nameof(f) + open(joinpath(dir, @sprintf("%05d-%s.ll", counter, name)), "w") do io + code_llvm(io, f, tt, raw=true, optimize=optimize, dump_module=true, debuginfo=:none) + end + counter+=1 +end + From 8fd58471fec51b81d8cb5fe7ef5942140a9870ad Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 29 May 2019 13:32:32 -0400 Subject: [PATCH 2/2] Update test/testhelpers/llvmpasses.jl Co-Authored-By: Alex Arslan --- test/testhelpers/llvmpasses.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/testhelpers/llvmpasses.jl b/test/testhelpers/llvmpasses.jl index 09f152a064475..0b443c3eb1535 100644 --- a/test/testhelpers/llvmpasses.jl +++ b/test/testhelpers/llvmpasses.jl @@ -1,3 +1,5 @@ +# This file is a part of Julia. License is MIT: https://julialang.org/license + using InteractiveUtils using Printf