[PATCH] D122929: [BOLT] Check for !isTailCall in isUnconditionalBranch
Vladislav Khmelevsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 13:40:19 PDT 2022
This revision was automatically updated to reflect the committed changes.
yota9 marked an inline comment as done.
Closed by commit rG2e51a3221956: [BOLT] Check for !isTailCall in isUnconditionalBranch (authored by yota9).
Changed prior to commit:
https://reviews.llvm.org/D122929?vs=420444&id=420622#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122929/new/
https://reviews.llvm.org/D122929
Files:
bolt/include/bolt/Core/MCPlusBuilder.h
bolt/lib/Target/X86/X86MCPlusBuilder.cpp
bolt/test/AArch64/ext-double-jump.s
Index: bolt/test/AArch64/ext-double-jump.s
===================================================================
--- /dev/null
+++ bolt/test/AArch64/ext-double-jump.s
@@ -0,0 +1,31 @@
+# This test checks that remove double jumps pass works properly with
+# non-local branches.
+
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
+# RUN: %clang %cflags -nostartfiles -nodefaultlibs %t.o -o %t.exe -Wl,-q
+# RUN: llvm-bolt %t.exe -o %t.bolt -peepholes=double-jumps
+
+ .text
+ .align 4
+ .global dummy1
+ .type dummy1, %function
+dummy1:
+ mov x2, x0
+ ret
+ .size dummy1, .-dummy1
+
+ .global dummy2
+ .type dummy2, %function
+dummy2:
+ mov x1, x0
+ ret
+ .size dummy2, .-dummy2
+
+ .global _start
+ .type _start, %function
+_start:
+ cbz x10, 1f
+ b dummy1
+1:
+ b dummy2
+ .size _start, .-_start
Index: bolt/lib/Target/X86/X86MCPlusBuilder.cpp
===================================================================
--- bolt/lib/Target/X86/X86MCPlusBuilder.cpp
+++ bolt/lib/Target/X86/X86MCPlusBuilder.cpp
@@ -78,10 +78,6 @@
return Analysis->isBranch(Inst) && !isTailCall(Inst);
}
- bool isUnconditionalBranch(const MCInst &Inst) const override {
- return Analysis->isUnconditionalBranch(Inst) && !isTailCall(Inst);
- }
-
bool isNoop(const MCInst &Inst) const override {
return X86::isNOP(Inst.getOpcode());
}
Index: bolt/include/bolt/Core/MCPlusBuilder.h
===================================================================
--- bolt/include/bolt/Core/MCPlusBuilder.h
+++ bolt/include/bolt/Core/MCPlusBuilder.h
@@ -353,7 +353,7 @@
}
virtual bool isUnconditionalBranch(const MCInst &Inst) const {
- return Analysis->isUnconditionalBranch(Inst);
+ return Analysis->isUnconditionalBranch(Inst) && !isTailCall(Inst);
}
virtual bool isIndirectBranch(const MCInst &Inst) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122929.420622.patch
Type: text/x-patch
Size: 1857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220405/c7e18e6f/attachment.bin>
More information about the llvm-commits
mailing list