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
Paths
| Differential D124897
Extend switch condition in optimizeSwitchPhiConst when free ClosedPublic Authored by MatzeB on May 3 2022, 7:08 PM.
Details Summary 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
Diff Detail
Unit TestsFailed Event TimelineMatzeB added a parent revision: D124552: CodeGenPrepare: Replace constant PHI arguments with switch condition value.May 3 2022, 7:08 PM Comment Actions Push the previous patches in this sequence, so we can get some bot and real-world testing underway before adding complexity to the transform? Comment Actions The previous patches seem to be stable now, so LGTM with a couple of minor improvements.
This revision is now accepted and ready to land.May 17 2022, 1:07 PM MatzeB marked 2 inline comments as done. This revision was landed with ongoing or failed builds.May 18 2022, 4:25 PM Closed by commit rG8d03c49f498c: Extend switch condition in optimizeSwitchPhiConst when free (authored by MatzeB). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 430520 llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/CodeGen/X86/switch-phi-const.ll
llvm/test/Transforms/CodeGenPrepare/X86/switch-phi-const.ll
|
formatting: TryZext or TryZExt