[PATCH] D40706: Fix function pointer tail calls in armv8-M.base

Oliver Stannard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 07:07:46 PST 2017


olista01 requested changes to this revision.
olista01 added a comment.
This revision now requires changes to proceed.

Could you also add a test for the (i32, i64) case? We can currently emit the tail call for that (because r1 is not used).



================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:2289
+  if (Subtarget->isThumb1Only() && Outs.size() >= 4 &&
+      isa<LoadSDNode>(Callee.getNode()))
+      return false;
----------------
Why does it matter that the callee comes from a load? This code also triggers the error, without needing to load the function pointer:

  define void @_Z3fooPFviiiiE(void (i32, i32, i32, i32)* nocapture %bar) local_unnamed_addr #0 {
  entry:
    tail call void %bar(i32 0, i32 0, i32 0, i32 0)
    ret void
  }


================
Comment at: test/CodeGen/ARM/v8m-tail-call.ll:55
+  %1 = load i32 (i32, i32, i32, i32)*, i32 (i32, i32, i32, i32)** @fnptr
+  %2 = tail call i32 %1(i32 1, i32 2, i32 3, i32 4)
+  ret i32 %2
----------------
These tests should check that a blx is being emitted.


https://reviews.llvm.org/D40706





More information about the llvm-commits mailing list