[PATCH] D140931: Improve and enable folding of conditional branches with tail calls.

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 16:58:54 PST 2023


goldstein.w.n created this revision.
Herald added subscribers: pengfei, mstorsjo, hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

1. Make it so that conditional tail calls can be emitted even when there are multiple predecessors.

2. Don't guard the transformation behind -Os. Instead add a flag `MayChangeDirection` that guards against changing direction which is only enabled with optsize. Note on X86 (the only Target that implements this), branches are only replaced if the conditions match (so no direction change).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140931

Files:
  llvm/include/llvm/CodeGen/TargetInstrInfo.h
  llvm/lib/CodeGen/BranchFolding.cpp
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86InstrInfo.h
  llvm/test/CodeGen/X86/add.ll
  llvm/test/CodeGen/X86/atom-pad-short-functions.ll
  llvm/test/CodeGen/X86/avx512-i1test.ll
  llvm/test/CodeGen/X86/bmi.ll
  llvm/test/CodeGen/X86/brcond.ll
  llvm/test/CodeGen/X86/btq.ll
  llvm/test/CodeGen/X86/cmp-merge.ll
  llvm/test/CodeGen/X86/cmp.ll
  llvm/test/CodeGen/X86/comi-flags.ll
  llvm/test/CodeGen/X86/extern_weak.ll
  llvm/test/CodeGen/X86/fold-rmw-ops.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-cmp-fp16.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-cmp.ll
  llvm/test/CodeGen/X86/funnel-shift.ll
  llvm/test/CodeGen/X86/jump_sign.ll
  llvm/test/CodeGen/X86/neg_cmp.ll
  llvm/test/CodeGen/X86/or-branch.ll
  llvm/test/CodeGen/X86/peep-test-4.ll
  llvm/test/CodeGen/X86/pr37025.ll
  llvm/test/CodeGen/X86/pr37063.ll
  llvm/test/CodeGen/X86/rd-mod-wr-eflags.ll
  llvm/test/CodeGen/X86/segmented-stacks.ll
  llvm/test/CodeGen/X86/sibcall.ll
  llvm/test/CodeGen/X86/slow-incdec.ll
  llvm/test/CodeGen/X86/sqrt-partial.ll
  llvm/test/CodeGen/X86/switch-bt.ll
  llvm/test/CodeGen/X86/tail-opts.ll
  llvm/test/CodeGen/X86/tailcall-cgp-dup.ll
  llvm/test/CodeGen/X86/tailcall-extract.ll
  llvm/test/CodeGen/X86/xor-icmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140931.486118.patch
Type: text/x-patch
Size: 119485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230104/606e876e/attachment.bin>


More information about the llvm-commits mailing list