[PATCH] D124897: Extend switch condition in optimizeSwitchPhiConst when free

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 19:08:34 PDT 2022


MatzeB created this revision.
MatzeB added reviewers: spatel, wenlei, modimo, craig.topper.
Herald added subscribers: StephenFan, pengfei, hiraditya, mcrosier.
Herald added a project: All.
MatzeB requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In a case like:

  switch((i32)x) { case 42: phi((i64)42, ...); }

replace `(i64)42` with `zext(x)` when we can do so for free.

This fixes a part of https://github.com/llvm/llvm-project/issues/55153


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124897

Files:
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/test/CodeGen/X86/switch-phi-const.ll
  llvm/test/Transforms/CodeGenPrepare/X86/switch-phi-const.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124897.426892.patch
Type: text/x-patch
Size: 7089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220504/fc41f6a7/attachment.bin>


More information about the llvm-commits mailing list