[PATCH] D93850: [InstCombine] Rewrite (switch (zext X)) as (switch X).

Chenguang Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 28 13:47:04 PST 2020


wecing added a comment.

@lebedev.ri , here <https://godbolt.org/z/cx1oK1> is what GVN does for the current output, and this <https://godbolt.org/z/6YY3W1> is the new behavior. Note that the first one does

  %cond2 = icmp eq i32 %1, 3
  br i1 %cond2, label %bb10, label %bb11

while in the second one it's just

  br i1 true, label %bb10, label %bb11



> that sounds like a GVN bug to me

Probably, but I am not sure whether GVN or InstCombine (or both?) is supposed to know that if `zext X == 3` then `X == 3`.

> Ah yes, sorry, so the example would already be optimized, just to a different width.

Not if you include the target datalayout <https://godbolt.org/z/zs1j83>.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93850/new/

https://reviews.llvm.org/D93850



More information about the llvm-commits mailing list