[llvm] [InstCombine] Canonicalize non-i8 gep of mul to i8 (PR #96606)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 7 00:59:25 PDT 2024


================
@@ -1057,8 +1057,8 @@ define i8 @test_gep_bitcast_array_different_size_element(ptr %arr, i64 %N) {
 
 define i64 @test_gep_bitcast_array_same_size_element_as1(ptr addrspace(1) %arr, i16 %N) {
 ; CHECK-LABEL: @test_gep_bitcast_array_same_size_element_as1(
-; CHECK-NEXT:    [[V:%.*]] = shl i16 [[N:%.*]], 3
-; CHECK-NEXT:    [[T:%.*]] = getelementptr i64, ptr addrspace(1) [[ARR:%.*]], i16 [[V]]
+; CHECK-NEXT:    [[T_IDX:%.*]] = shl i16 [[N:%.*]], 6
+; CHECK-NEXT:    [[T:%.*]] = getelementptr i8, ptr addrspace(1) [[ARR:%.*]], i16 [[T_IDX]]
 ; CHECK-NEXT:    [[X:%.*]] = load i64, ptr addrspace(1) [[T]], align 4
----------------
vfdff wrote:

hi @davemgreen 
   Should we check the range of **[[T_IDX:%.*]] = shl i16 [[N:%.*]], 6** it not overflow the **i16**

https://github.com/llvm/llvm-project/pull/96606


More information about the llvm-commits mailing list