-
Couldn't load subscription status.
- Fork 15k
[FastIsel] Get the right register type for call instruction #164565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 | ||
| ; RUN: llc --fast-isel < %s -mtriple=x86_64-unknown-unknown | FileCheck %s | ||
|
|
||
| define i8 @test_direct_call(ptr %f) nounwind { | ||
| ; CHECK-LABEL: test_direct_call: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: pushq %rax | ||
| ; CHECK-NEXT: callq foo@PLT | ||
| ; CHECK-NEXT: callq bar@PLT | ||
| ; CHECK-NEXT: popq %rcx | ||
| ; CHECK-NEXT: retq | ||
| entry: | ||
| %call = call bfloat @foo(ptr %f) | ||
| %call2 = call zeroext i8 @bar(bfloat %call) | ||
| ret i8 %call2 | ||
| } | ||
|
|
||
| define i8 @test_fast_direct_call(ptr %f) nounwind { | ||
| ; CHECK-LABEL: test_fast_direct_call: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: pushq %rax | ||
| ; CHECK-NEXT: callq foo_fast@PLT | ||
| ; CHECK-NEXT: callq bar@PLT | ||
| ; CHECK-NEXT: popq %rcx | ||
| ; CHECK-NEXT: retq | ||
| entry: | ||
| %call = call fastcc bfloat @foo_fast(ptr %f) | ||
| %call2 = call zeroext i8 @bar(bfloat %call) | ||
| ret i8 %call2 | ||
| } | ||
|
|
||
| define i8 @test_indirect_all(ptr %fptr, ptr %f) nounwind { | ||
| ; CHECK-LABEL: test_indirect_all: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: pushq %rbx | ||
| ; CHECK-NEXT: movq %rdi, %rbx | ||
| ; CHECK-NEXT: movq %rsi, %rdi | ||
| ; CHECK-NEXT: callq foo@PLT | ||
| ; CHECK-NEXT: callq *%rbx | ||
| ; CHECK-NEXT: popq %rbx | ||
| ; CHECK-NEXT: retq | ||
| entry: | ||
| %call = call bfloat @foo(ptr %f) | ||
| %call2 = call zeroext i8 %fptr(bfloat %call) | ||
| ret i8 %call2 | ||
| } | ||
|
|
||
| define i8 @test_fast_indirect_all(ptr %fptr, ptr %f) nounwind { | ||
| ; CHECK-LABEL: test_fast_indirect_all: | ||
| ; CHECK: # %bb.0: # %entry | ||
| ; CHECK-NEXT: pushq %rbx | ||
| ; CHECK-NEXT: movq %rdi, %rbx | ||
| ; CHECK-NEXT: movq %rsi, %rdi | ||
| ; CHECK-NEXT: callq foo@PLT | ||
| ; CHECK-NEXT: callq *%rbx | ||
| ; CHECK-NEXT: popq %rbx | ||
| ; CHECK-NEXT: retq | ||
| entry: | ||
| %call = call fastcc bfloat @foo(ptr %f) | ||
| %call2 = call zeroext i8 %fptr(bfloat %call) | ||
| ret i8 %call2 | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add the same testcase wit Han indirect call. Can you also test each case with a non-default calling convention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added test case for indirect call and fast calling convention. |
||
| declare bfloat @foo(ptr %f) | ||
| declare zeroext i8 @bar(bfloat) | ||
| declare fastcc bfloat @foo_fast(ptr %f) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should also be CallBase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean CallBase can cover
invoke,callbrinstructions which also have cconv, but CallInst only covercallinstruction?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to create a test case for
callbr, but I got llc crash with below case. It seems x86 don't support half or bfloat type in inline assembly.error: couldn't allocate output register for constraint 'x'
I also got llc crash when running below test case for
invoke.So I'd like to keep it as
CallInstfor now. When bfloat is better supported incallbrandinvoke, we can reviewCallInstand support more call-alike instruction.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callbr is special but invoke is straightforward. You should also fix whatever the crash is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This absolutely needs to be CallBase, leaving this like this is just waiting for someone else to waste time debugging this in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let me create a PR to change it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a PR #164769, but it is difficult to create a test case. We need to have a
callinstruction to use the output ofinvokeinstruction, besides, thecallandinvokeinstruction should be in the same basic block to trigger the issue. Below code can be a base code for the test case.