[llvm] [InstCombine] Canonicalize gep scaling factor (PR #180216)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 07:47:51 PST 2026
================
@@ -320,7 +325,11 @@ define ptr @geps_combinable_scalable_vector_array(ptr %a, i64 %idx) {
define i1 @compare_geps_same_indices(ptr %a, ptr %b, i64 %idx) {
; CHECK-LABEL: @compare_geps_same_indices(
-; CHECK-NEXT: [[C:%.*]] = icmp eq ptr [[A:%.*]], [[B:%.*]]
+; CHECK-NEXT: [[TMP1:%.*]] = shl i64 [[IDX:%.*]], 2
+; CHECK-NEXT: [[A:%.*]] = getelementptr i8, ptr [[A1:%.*]], i64 [[TMP1]]
+; CHECK-NEXT: [[TMP2:%.*]] = shl i64 [[IDX]], 2
+; CHECK-NEXT: [[B:%.*]] = getelementptr i8, ptr [[B1:%.*]], i64 [[TMP2]]
+; CHECK-NEXT: [[C:%.*]] = icmp eq ptr [[A]], [[B]]
----------------
nikic wrote:
Regression, but only in the absence of CSE.
https://github.com/llvm/llvm-project/pull/180216
More information about the llvm-commits
mailing list