[PATCH] D112860: [X86] Fix X32 indirect call generation

Harald van Dijk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 3 09:44:12 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG889c2b97bd8c: [X86] Fix X32 indirect call generation (authored by hvdijk).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112860/new/

https://reviews.llvm.org/D112860

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/call-structfp.ll


Index: llvm/test/CodeGen/X86/call-structfp.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/X86/call-structfp.ll
@@ -0,0 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnux32 | FileCheck %s
+declare { i64, void ()* } @f()
+define void @pr52357() {
+; CHECK-LABEL: pr52357:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    pushq %rax
+; CHECK-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-NEXT:    callq f at PLT
+; CHECK-NEXT:    movl %edx, %eax
+; CHECK-NEXT:    popq %rcx
+; CHECK-NEXT:    .cfi_def_cfa_offset 8
+; CHECK-NEXT:    jmpq *%rax # TAILCALL
+entry:
+  %0 = tail call { i64, void ()* } @f()
+  %1 = extractvalue { i64, void ()* } %0, 1
+  tail call void %1()
+  ret void
+}
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -4537,7 +4537,7 @@
     // address into a register.
     Callee = LowerGlobalOrExternal(Callee, DAG, /*ForCall=*/true);
   } else if (Subtarget.isTarget64BitILP32() &&
-             Callee->getValueType(0) == MVT::i32) {
+             Callee.getValueType() == MVT::i32) {
     // Zero-extend the 32-bit Callee address into a 64-bit according to x32 ABI
     Callee = DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i64, Callee);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112860.384495.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211103/75007d49/attachment.bin>


More information about the llvm-commits mailing list