[llvm] [AMDGPULowerBufferFatPointers] Simplify and fix GEP offset emission (PR #95115)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 08:48:29 PDT 2024
================
@@ -119,7 +124,8 @@ define ptr addrspace(7) @zero_gep_goes_first(ptr addrspace(7) %v0, i32 %arg) {
; CHECK-SAME: ({ ptr addrspace(8), i32 } [[V0:%.*]], i32 [[ARG:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: [[V0_RSRC:%.*]] = extractvalue { ptr addrspace(8), i32 } [[V0]], 0
; CHECK-NEXT: [[V0_OFF:%.*]] = extractvalue { ptr addrspace(8), i32 } [[V0]], 1
-; CHECK-NEXT: [[V2:%.*]] = add i32 [[V0_OFF]], [[ARG]]
+; CHECK-NEXT: [[V1:%.*]] = add i32 [[V0_OFF]], 0
----------------
nikic wrote:
Yes, we could use InstSimplifyFolder. We could also avoid emitting these in emitGEPOffset() directly -- it's currently used primarily in InstCombine where this doesn't matter, but for other usages it's probably nice to not generate "add 0", especially as zero-indices are somewhat common in "old-style" GEPs.
https://github.com/llvm/llvm-project/pull/95115
More information about the llvm-commits
mailing list