Hi,
I’ve written a pass that basically does some code transformations to enable parallel execution of loops. After the transformation llvm runs BitCode Writer pass , which is aborting with Unreachable Executed error.
I have attached the input llvm code and the output llvm code for reference. I am stuck at this problem for a few days now. Please let me know if you are able to find anything unusual.
Regards,
Adarsh
input (3.94 KB)
output (5.87 KB)
Hi,
I’ve written a pass that basically does some code transformations to enable parallel execution of loops. After the transformation llvm runs BitCode Writer pass , which is aborting with Unreachable Executed error.
I have attached the input llvm code and the output llvm code for reference. I am stuck at this problem for a few days now. Please let me know if you are able to find anything unusual.
Have you tried running the module verifier after your transform, before writing out to bitcode?
Nick
Yes. Intially the pass was crashing when the module when the module verifier was running. I was able to solve that and now it is crashing when the bit writer pass is running.
Adarsh Yoga wrote:
Yes. Intially the pass was crashing when the module when the module
verifier was running. I was able to solve that and now it is crashing
when the bit writer pass is running.
The output is wrong in @thread_pool_init:
<stdin>:44:27: error: '%4' defined with type 'i1'
%5 = getelementptr i32* %4, i64 %indvar ; <i32*> [#uses=1]
^
where
%4 = icmp slt i32 %threadnumber, 1 ; <i1> [#uses=2]
meaning that %4 is an i1 not an i32*. I'm not sure how you managed to do this, and how the verifier didn't catch it. Maybe the %4 operand is actually an instruction in another function?
I'll try to reproduce this and fix the verifier to catch it.
Nick
I was able to solve that but still crashing with the same error saying “Unreachable executed”. I have attached the output with this mail.
Thanks in advance.
new-output (4.72 KB)
Adarsh Yoga wrote:
I was able to solve that
What was wrong? I wasn't able to reproduce it and would still like to teach the verifier whatever it missed.
but still crashing with the same error saying
"Unreachable executed". I have attached the output with this mail.
This time you've got:
%1 = load i32** getelementptr inbounds ({ i32* }* @structobj, i64 0, i32 0)
in @temp0 but @structobj is nowhere in the file, which implies that you created the GlobalValue but never inserted it.
You can figure this out for yourself by taking the module dump (be sure to remove "The Module: " from the beginning) and running llvm-as on it. It finds these errors.
Nick
Initially, tt was not a problem with the verifier, we were just inserting a wrong instruction in our pass. Also we were able to figure out the error you pointed out and our pass is running as intended!!! Thanks a lot.
Adarsh Yoga wrote:
Initially, tt was not a problem with the verifier, we were just
inserting a wrong instruction in our pass.
Of course the verifier wasn't causing your problems. I want to find out why the verifier did not catch and error on the invalid module.
Also we were able to figure
out the error you pointed out and our pass is running as intended!!!
That's great to hear!
Could you explain, briefly, what your bug was? Something more specific than 'inserting a wrong instruction'?
Nick