[PATCH] D59506: [ValueTracking][InstSimplify] Support min/max selects in computeConstantRange()

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 12:04:04 PDT 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: llvm/test/CodeGen/AMDGPU/smed3.ll:48
+; GCN: v_mov_b32_e32 v{{[0-9]+}}, 12
 define amdgpu_kernel void @v_test_smed3_r_i_i_constant_order_i32(i32 addrspace(1)* %out, i32 addrspace(1)* %aptr) #1 {
   %tid = call i32 @llvm.amdgcn.workitem.id.x()
----------------
arsenm wrote:
> The test should be fixed so this is still testing what it intends to
>From what I understand, the test is here to ensure that a "clamp" pattern with swapped constants is not incorrectly compiled to a `med3` instruction. After this change this kind of pattern is always constant folded by InstSimplify. From the debug log, in this case the simplification is caused by an EarlyCSE pass added by the AMDGPU target. I haven't found a way to disable it.

Do you have any ideas/pointers on how this pattern can be preserved all the way down to isel?


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

https://reviews.llvm.org/D59506





More information about the llvm-commits mailing list