[PATCH] D103788: [InstCombine] Eliminate casts to optimize ctlz operation

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 8 10:41:27 PDT 2021


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/zext-ctlz-trunc-to-ctlz-add.ll:53
+
+define i32 @trunc_ctlz_zext_i32_i64(i32 %x) {
+; CHECK-LABEL: @trunc_ctlz_zext_i32_i64(
----------------
There are a lot of tests here that don't provide much extra coverage. These are only changing the types to confirm that we get the add constant correct? I think we can verify that with 2 tests of varying types (including a vector type), but we can do better by using a weird type (for example 3 x i17). We can also get more value by varying the 2nd parameter (make it `true` half of the time?).


================
Comment at: llvm/test/Transforms/InstCombine/zext-ctlz-trunc-to-ctlz-add.ll:215
+  %x1 = trunc i32 %p to i16
+  %y = trunc i32 %p to i16
+  %zz = add nsw i16 %x1, %y
----------------
Typically, we make the extra use minimal and more plausible by adding a `call void @use(i32 %p)` instruction.
Also, what happens if the zext has an extra use?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103788



More information about the llvm-commits mailing list