[all-commits] [llvm/llvm-project] 458c23: GlobalISel/AArch64: don't optimize away redundant ...
adrian-prantl via All-commits
all-commits at lists.llvm.org
Wed Jul 7 12:52:32 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 458c230b5ef893238d2471fcff27cd275e8026d5
https://github.com/llvm/llvm-project/commit/458c230b5ef893238d2471fcff27cd275e8026d5
Author: Adrian Prantl <aprantl at apple.com>
Date: 2021-07-07 (Wed, 07 Jul 2021)
Changed paths:
M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
M llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll
M llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
M llvm/test/CodeGen/AArch64/unwind-preserved.ll
M llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/jump_table_and_brjt.ll
M llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/long_ambiguous_chain_s32.ll
M llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/long_ambiguous_chain_s64.ll
M llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/phi.ll
A llvm/test/DebugInfo/AArch64/fallthrough-branch.ll
Log Message:
-----------
GlobalISel/AArch64: don't optimize away redundant branches at -O0
This patch prevents GlobalISel from optimizing out redundant branch
instructions when compiling without optimizations.
The motivating example is code like the following common pattern in
Swift, where users expect to be able to set a breakpoint on the early
exit:
public func f(b: Bool) {
guard b else {
return // I would like to set a breakpoint here.
}
...
}
The patch modifies two places in GlobalISEL: The first one is in
IRTranslator.cpp where the removal of redundant branches is made
conditional on the optimization level. The second one is in
AArch64InstructionSelector.cpp where an -O0 *only* optimization is
being removed.
Disabling these optimizations increases code size at -O0 by
~8%. However, doing so improves debuggability, and debug builds are
the primary reason why developers compile without optimizations. We
thus concluded that this is the right trade-off.
rdar://79515454
Differential Revision: https://reviews.llvm.org/D105238
More information about the All-commits
mailing list