willi19 / swpp202301-compiler-team6

MIT License
0 stars 0 forks source link

Approaches/Infrastructure on debugging LLVM IR miscompilation #13

Open goranmoomin opened 1 year ago

goranmoomin commented 1 year ago

So I'm suspecting I have a bad miscompilation bug in the Load2AloadPass I wrote; I'm documenting details on the miscompilation on the PR itself. For now, I think we need to think approaches on debugging IR miscompilation before we get even busier than this.

Already assuming that we have Alive2 set up, since I think it can be useful if it's useful in finding out miscompilations. Not in my current case.

From my current experience, I think we need some way to apply transformations limited times, and find out what transformation causes a miscompilation; AFAIK LLVM has some supporting infrastructure for this, so I'll try to look on it.

I'm also trying to set up the LLVM's supporting infrastructure to create dot files from an IR; I'm hoping that it will be able to allow us to find how the C langauge got compiled into IR, since it took a fair amount of time to find which basic blocks are associated with which part.

We also really need some debugger to hook up on the interpreter, if I can't find why this is erroring out, I think I'll have to hack the interpreter and allow printing how the memory looks. The current status... is hard to find out what is happening. I'm hoping to be able to at least print some register variables by adding some comments on the assembly.