llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Why nop inserted for ppc64 b/w branches

Open ukalappa-mips opened this issue 4 years ago • 13 comments

Why nop inserted for the callee's for the line 14 and 15 ,but not line 11 and 12.

https://godbolt.org/z/Kj4Y5x3o7

We need to notoc based call for the example ,how we do the same for ppc64

ukalappa-mips avatar May 20 '22 08:05 ukalappa-mips

Its not the case for ppc32 . https://godbolt.org/z/o8nMobzPb

ukalappa-mips avatar May 20 '22 08:05 ukalappa-mips

@llvm/issue-subscribers-backend-powerpc

llvmbot avatar May 20 '22 14:05 llvmbot

Like an issue to fast-isel only. If compile with optimization(declare callee with noinline attribute), the code gen is expected, no nop after bl.

chenzheng1030 avatar May 23 '22 02:05 chenzheng1030

@chenzheng1030 ,agree and fast-isel should be fixed in debug mode.

ukalappa-mips avatar May 23 '22 05:05 ukalappa-mips

Sure, we will have a look

chenzheng1030 avatar May 23 '22 05:05 chenzheng1030

https://reviews.llvm.org/D126205 & nfc refactor patch https://reviews.llvm.org/D126203 are posted for this issue.

chenzheng1030 avatar May 23 '22 14:05 chenzheng1030

What problem does the nop pose? Is this a concern due to code size? Performance shouldn't be affected and even if it is, this is restricted to -O0. I don't think it is useful to do much analysis to figure out whether a nop is needed in FastISel. Compilation at -O0 with FastISel is supposed to be fast and the generated code definitely won't be fast. There should be a reasonably high barrier to entry for optimizations into this instruction selection pipeline. So if this isn't causing any issues but simply subjectively looks odd, I would prefer that we leave it as it is rather than adding complications to this selection pipeline.

nemanjai avatar May 25 '22 14:05 nemanjai

@nemanjai

What problem does the nop pose? We have the issue with gdb testing like we step into callee and finish from the callee() ,the pc is pointing like (gdb) s callee () at step-test.c:9 9 myglob++; return 0; (gdb) finish Run till exit from #0 callee () at step-test.c:9 0x000000000400090c in main () at step-test.c:45

i.e nop and but expected is next callee() call .

ukalappa-mips avatar May 26 '22 15:05 ukalappa-mips

Is it acceptable to add -mllvm -fast-isel=false to the command line for this type of testing to ensure we don't use Fast ISel? Here's your example with that option added: https://godbolt.org/z/8Kv1efed1

nemanjai avatar May 27 '22 12:05 nemanjai

@nemanjai ,yes we will fall back by disabling fast-isel.

ukalappa-mips avatar May 27 '22 13:05 ukalappa-mips

@UmeshKalappa0: Could you please point to commit?

EugeneZelenko avatar May 28 '22 04:05 EugeneZelenko

@EugeneZelenko No commit for this issue. The posted patches are abandoned. This issue can be solved by using option -mllvm -fast-isel=false.

chenzheng1030 avatar Jun 06 '22 02:06 chenzheng1030

@chenzheng1030: Thank you for clarification!

EugeneZelenko avatar Jun 06 '22 03:06 EugeneZelenko