[llvm] [InstCombine] Propagate debuglocs when replacing insert->extract elts (PR #206026)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 05:24:10 PDT 2026


================
@@ -0,0 +1,58 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -S -passes=instcombine %s | FileCheck %s
+
+;; InstCombine replaces the extract->insert pair with a pair of shufflevector
+;; instructions, which first widen the %load vector and then replace the
+;; extract->insert with a shufflevector of the widened vector and the insert
+;; vector.
+;; The first shufflevector, since it is materializing the same value as the
+;; %load in a different form, should use %load's debug location, and the
+;; second shufflevector, since it replaces a chain of instructions ending with
+;; the insert, should use the insert's debug location.
+
+source_filename = "reduced.ll"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define <4 x float> @widget(ptr %arg) !dbg !5 {
+; CHECK-LABEL: define <4 x float> @widget(
+; CHECK-SAME: ptr [[ARG:%.*]]) !dbg [[DBG5:![0-9]+]] {
+; CHECK-NEXT:  [[BB:.*:]]
+; CHECK-NEXT:    [[LOAD:%.*]] = load <2 x float>, ptr [[ARG]], align 4, !dbg [[DBG8:![0-9]+]]
+; CHECK-NEXT:    [[TMP0:%.*]] = shufflevector <2 x float> [[LOAD]], <2 x float> poison, <4 x i32> <i32 0, i32 poison, i32 poison, i32 poison>, !dbg [[DBG8]]
+; CHECK-NEXT:    [[INSERTELEMENT:%.*]] = shufflevector <4 x float> [[TMP0]], <4 x float> <float poison, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00>, <4 x i32> <i32 0, i32 5, i32 6, i32 7>, !dbg [[DBG9:![0-9]+]]
+; CHECK-NEXT:    ret <4 x float> [[INSERTELEMENT]], !dbg [[DBG10:![0-9]+]]
+;
----------------
SLTozer wrote:

These comments (and the other similar comments below) were generated by `update_test_checks.py` - I think they should be left as-is, either because the script actually uses it in some way, or else because I expect it would simply re-generate them next time it gets run on this file, so better to avoid the extra diff in future.

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


More information about the llvm-commits mailing list