[PATCH] D122929: [BOLT] Fix remove double jumps peephole pass
Vladislav Khmelevsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 03:53:19 PDT 2022
yota9 updated this revision to Diff 420444.
yota9 added a comment.
Herald added a subscriber: pengfei.
@rafauler Thanks for your suggestion, I've missed that moment, I think you're right
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,28 @@
+# 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
+
+ .global dummy2
+ .type dummy2, %function
+dummy2:
+ mov x1, x0
+ ret
+
+ .global _start
+ .type _start, %function
+_start:
+ cbz x10, 1f
+ b dummy1
+1:
+ b dummy2
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.420444.patch
Type: text/x-patch
Size: 1779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220405/0a61562d/attachment.bin>
More information about the llvm-commits
mailing list