On 05.02.2016 03:52, Tom Stellard wrote: > On Thu, Feb 04, 2016 at 09:15:26AM +0100, Nicolai Hähnle wrote: >> From: Nicolai Hähnle <nicolai.haeh...@amd.com> >> >> Set R600_DEBUG=preoptir to dump the LLVM IR before optimization passes, >> to allow diagnosing problems caused by optimization passes. >> >> Note that in order to compile the resulting IR with llc, you will first >> have to run at least the mem2reg pass, e.g. >> >> opt -mem2reg -S < shader.ll | llc -march=amdgcn -mcpu=bonaire >> >> Signed-off-by: Michel Dänzer <michel.daen...@amd.com> (original patch) >> Signed-off-by: Nicolai Hähnle <nicolai.haeh...@amd.com> (w/ debug flag) >> --- >> Having the option is a good idea, but I prefer to have a separate debug >> flag for it so that when you try to analyze bugs in codegen (which in >> my experience happens more often) you don't have to worry about >> replicating the exact same sequence of optimizations manually via the >> command line to reproduce the problem there.
[...] >> @@ -4385,9 +4391,15 @@ int si_shader_create(struct si_screen *sscreen, >> LLVMTargetMachineRef tm, >> } >> >> LLVMBuildRetVoid(bld_base->base.gallivm->builder); >> + mod = bld_base->base.gallivm->module; >> + >> + /* Dump LLVM IR before any optimization passes */ >> + if (sscreen->b.debug_flags & DBG_PREOPT_IR && >> + r600_can_dump_shader(&sscreen->b, si_shader_ctx.type)) >> + LLVMDumpModule(mod); >> + > > Is there any reason not to add the dump in radeon_llvm_finalize_module() > after PromoteMem2Reg has run? This would make the output readable by llc > and then you would only need to add the dump call in one place. FWIW, Mem2Reg doesn't seem to be the only pass necessary for llc. E.g. on https://secure.freedesktop.org/~daenzer/The-Spirit.txt it was choking on one of the control flow lines with a label and comment for me. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev