[all-commits] [llvm/llvm-project] 8d03c4: Extend switch condition in optimizeSwitchPhiConst ...

Matthias Braun via All-commits all-commits at lists.llvm.org
Wed May 18 16:25:12 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d03c49f498cb19358aacd28f57a852549d34ebd
      https://github.com/llvm/llvm-project/commit/8d03c49f498cb19358aacd28f57a852549d34ebd
  Author: Matthias Braun <matze at braunis.de>
  Date:   2022-05-18 (Wed, 18 May 2022)

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

  Log Message:
  -----------
  Extend switch condition in optimizeSwitchPhiConst when free

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

Differential Revision: https://reviews.llvm.org/D124897




More information about the All-commits mailing list