How to track down a bad llvm optimization pass

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Jun 17 05:48:55 PDT 2016


On 17 Jun 2016, at 13:39, Kagamin via digitalmars-d-ldc wrote:
> Can't it be ruled out by the `opt` tool? Though I thought it's strange 
> how it works on ir-to-ir level.

I'm not sure I understand. What would `opt` rule out exactly? Yes, it 
allows you to run a custom subset of passes – `ldc2 -O2 
-debug-pass=Arguments …` is very useful for that, by the way – but 
you still need to manually remove subsets of passes and re-build the 
executable until the issue disappears. (As an aside: Now that LDC 
accepts bitcode files on the command line, this doesn't require manually 
messing with object file emission/linking anymore.)

By the way, the fact that it both consumes and produces IR is actually 
not strange at all; that's simply how the main LLVM optimiser is 
architected (with the exception of a further, mostly target-specific, 
optimisation stage during code generation).

  — David


More information about the digitalmars-d-ldc mailing list