Hi, I'm writing a pass that implements a jump table with an array of blockaddress and an indirectbr instruction. It get a blockaddress in the array (via getelementptr and an index) and then jump to this basicblock via the indirectbr. I tried to compile several libraries to test my pass and the run their test-suite. It works fine with, for e.g, libTomCrypt (in -O0,1,2,3). With GMP or ImageMagick it works fine in -O0, but whenever I try in -O1,2,3 it fail and I get a tons of errors like (note that the compilation/link of the libs itself works, it fails when I make a 'make check'): ... ./.libs/libtests.a(misc.o):(.rodata+0x5b0): undefined reference to `.Ltmp491' ./.libs/libtests.a(misc.o):(.rodata+0x5b8): undefined reference to `.Ltmp492' ./.libs/libtests.a(misc.o):(.rodata+0x5c0): undefined reference to `.Ltmp493' ./.libs/libtests.a(misc.o):(.rodata+0x5c8): undefined reference to `.Ltmp494' ... I tried to modify my pass, call my pass in the PassManagerBuilder at different places,... But I still got the same errors each time. I ran out of ideas where to look :( I got this problem both on Linux and OSX. Any idea which pass could cause this problem ? Maybe it's a pass in the backend ? Cheers !
I don't know which pass it is, but have you tried dumping the final IR to see whether that IR still contains the right code? You can do that using opt to do the optimization. You can also use -print-after or -print-after-all to see the IR after each pass. On Wed, Mar 26, 2014 at 10:51 AM, Rinaldini Julien < julien.rinaldini at heig-vd.ch> wrote:> Hi, > > I'm writing a pass that implements a jump table with an array of > blockaddress and an indirectbr instruction. > > It get a blockaddress in the array (via getelementptr and an index) and > then jump to this basicblock via the indirectbr. > > I tried to compile several libraries to test my pass and the run their > test-suite. It works fine with, for e.g, libTomCrypt (in -O0,1,2,3). > With GMP or ImageMagick it works fine in -O0, but whenever I try in > -O1,2,3 it fail and I get a tons of errors like (note that the > compilation/link of the libs itself works, it fails when I make a 'make > check'): > > ... > ./.libs/libtests.a(misc.o):(.rodata+0x5b0): undefined reference to > `.Ltmp491' > ./.libs/libtests.a(misc.o):(.rodata+0x5b8): undefined reference to > `.Ltmp492' > ./.libs/libtests.a(misc.o):(.rodata+0x5c0): undefined reference to > `.Ltmp493' > ./.libs/libtests.a(misc.o):(.rodata+0x5c8): undefined reference to > `.Ltmp494' > ... > > I tried to modify my pass, call my pass in the PassManagerBuilder at > different places,... But I still got the same errors each time. > > I ran out of ideas where to look :( I got this problem both on Linux and > OSX. > > Any idea which pass could cause this problem ? Maybe it's a pass in the > backend ? > > Cheers ! > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140326/912b5d68/attachment.html>
Thanks for your answer ! Normally, I use verifyFunction(...) or verifyModule(...) to check if my IR is correct. So normally the code should be correct. I'll try to call my pass with opt, maybe I'll be able to identify the 'faulty' pass. Thanks again. On 03/27/2014 12:10 AM, Tom Roeder wrote: I don't know which pass it is, but have you tried dumping the final IR to see whether that IR still contains the right code? You can do that using opt to do the optimization. You can also use -print-after or -print-after-all to see the IR after each pass. On Wed, Mar 26, 2014 at 10:51 AM, Rinaldini Julien <julien.rinaldini at heig-vd.ch<mailto:julien.rinaldini at heig-vd.ch>> wrote: Hi, I'm writing a pass that implements a jump table with an array of blockaddress and an indirectbr instruction. It get a blockaddress in the array (via getelementptr and an index) and then jump to this basicblock via the indirectbr. I tried to compile several libraries to test my pass and the run their test-suite. It works fine with, for e.g, libTomCrypt (in -O0,1,2,3). With GMP or ImageMagick it works fine in -O0, but whenever I try in -O1,2,3 it fail and I get a tons of errors like (note that the compilation/link of the libs itself works, it fails when I make a 'make check'): ... ./.libs/libtests.a(misc.o):(.rodata+0x5b0): undefined reference to `.Ltmp491' ./.libs/libtests.a(misc.o):(.rodata+0x5b8): undefined reference to `.Ltmp492' ./.libs/libtests.a(misc.o):(.rodata+0x5c0): undefined reference to `.Ltmp493' ./.libs/libtests.a(misc.o):(.rodata+0x5c8): undefined reference to `.Ltmp494' ... I tried to modify my pass, call my pass in the PassManagerBuilder at different places,... But I still got the same errors each time. I ran out of ideas where to look :( I got this problem both on Linux and OSX. Any idea which pass could cause this problem ? Maybe it's a pass in the backend ? Cheers ! _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev