[all-commits] [llvm/llvm-project] ce3812: [RISCV] Avoid redundant branch-to-branch when expa...
Alex Bradbury via All-commits
all-commits at lists.llvm.org
Wed Aug 17 05:49:39 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ce381281940fb6a9cc2fa1a16fa36bf0911f43f1
https://github.com/llvm/llvm-project/commit/ce381281940fb6a9cc2fa1a16fa36bf0911f43f1
Author: Alex Bradbury <asb at igalia.com>
Date: 2022-08-17 (Wed, 17 Aug 2022)
Changed paths:
M llvm/lib/Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp
M llvm/test/CodeGen/RISCV/atomic-cmpxchg-branch-on-result.ll
Log Message:
-----------
[RISCV] Avoid redundant branch-to-branch when expanding cmpxchg
If the success value of a cmpxchg is used in a branch, the expanded
cmpxchg sequence ends up with a redundant branch-to-branch (as the
backend atomics expansion happens as late as possible, passes to
optimise such cases have already run). This patch identifies this case
and avoid it when expanding the cmpxchg.
Note that a similar optimisation is possible for a BEQ on the cmpxchg
success value. As it's hard to imagine a case where real-world code may
do that, this patch doens't handle that case.
Differential Revision: https://reviews.llvm.org/D130192
More information about the All-commits
mailing list