[PATCH] D81081: [PowerPC] Remove extra nop after notoc call

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 04:56:07 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8dbf5a95014f: [PowerPC] Remove extra nop after notoc call (authored by stefanp).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81081

Files:
  llvm/lib/Target/PowerPC/PPCInstr64Bit.td
  llvm/test/CodeGen/PowerPC/pcrel-call-linkage-simple.ll


Index: llvm/test/CodeGen/PowerPC/pcrel-call-linkage-simple.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/pcrel-call-linkage-simple.ll
+++ llvm/test/CodeGen/PowerPC/pcrel-call-linkage-simple.ll
@@ -36,3 +36,27 @@
 
 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)
 
+
+; CHECK-S-LABEL: callerNoTail
+; CHECK-S:     bl callee at notoc
+; CHECK-S-NOT: nop
+; CHECK-S:     bl callee at notoc
+; CHECK-S-NOT: nop
+; CHECK-S:     blr
+
+; CHECK-O-LABEL: callerNoTail
+; CHECK-O:      bl
+; CHECK-O-NEXT: R_PPC64_REL24_NOTOC callee
+; CHECK-O-NOT:  nop
+; CHECK-O:      bl
+; CHECK-O-NEXT: R_PPC64_REL24_NOTOC callee
+; CHECK-O-NOT:  nop
+; CHECK-O:      blr
+define dso_local signext i32 @callerNoTail() local_unnamed_addr {
+entry:
+  %call1 = tail call signext i32 bitcast (i32 (...)* @callee to i32 ()*)()
+  %call2 = tail call signext i32 bitcast (i32 (...)* @callee to i32 ()*)()
+  %add = add i32 %call1, %call2
+  ret i32 %add
+}
+
Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td
===================================================================
--- llvm/lib/Target/PowerPC/PPCInstr64Bit.td
+++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td
@@ -145,9 +145,9 @@
       // it does use R2 then it is just a caller saved register. Therefore it is
       // safe to emit only the bl and not the nop for this instruction. The
       // linker will not try to restore R2 after the call.
-      def BL8_NOTOC : IForm_and_DForm_4_zero<18, 0, 1, 24, (outs),
-                                             (ins calltarget:$func),
-                                             "bl $func", IIC_BrB, []>;
+      def BL8_NOTOC : IForm<18, 0, 1, (outs),
+                            (ins calltarget:$func),
+                            "bl $func", IIC_BrB, []>;
     }
   }
   let Uses = [CTR8, RM] in {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81081.268747.patch
Type: text/x-patch
Size: 1907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/d56188d0/attachment.bin>


More information about the llvm-commits mailing list