[llvm] [InstCombine] Preserve multi-dimensional array structure in GEP optimization (PR #176414)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 16 08:31:56 PST 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 168159 tests passed
* 2992 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.CodeGen/union-tbaa1.c</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/union-tbaa1.c -triple hexagon-unknown-elf -O2 -emit-llvm -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/union-tbaa1.c
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/union-tbaa1.c -triple hexagon-unknown-elf -O2 -emit-llvm -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/union-tbaa1.c
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/union-tbaa1.c:20:16: error: CHECK-NEXT: expected string not found in input
# | // CHECK-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [2 x %union.vect32], ptr [[TMP]], i32 [[TMP0]]
# |                ^
# | <stdin>:16:25: note: scanning from here
# |  %mul = mul i32 %1, %Num
# |                         ^
# | <stdin>:16:25: note: with "TMP" equal to "%Tmp"
# |  %mul = mul i32 %1, %Num
# |                         ^
# | <stdin>:16:25: note: with "TMP0" equal to "%0"
# |  %mul = mul i32 %1, %Num
# |                         ^
# | <stdin>:17:10: note: possible intended match here
# |  %arrayidx2 = getelementptr inbounds [4 x [2 x %union.vect32]], ptr %Tmp, i32 0, i32 %0
# |          ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGen/union-tbaa1.c
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           11:  %Tmp = alloca [4 x [2 x %union.vect32]], align 8 
# |           12:  call void @llvm.lifetime.start.p0(ptr nonnull %Tmp) #3 
# |           13:  %0 = load i32, ptr %Index, align 4, !tbaa !2 
# |           14:  %arrayidx = getelementptr inbounds [2 x i32], ptr %Arr, i32 %0 
# |           15:  %1 = load i32, ptr %arrayidx, align 4, !tbaa !2 
# |           16:  %mul = mul i32 %1, %Num 
# | next:20'0                             X error: no match found
# | next:20'1                               with "TMP" equal to "%Tmp"
# | next:20'2                               with "TMP0" equal to "%0"
# |           17:  %arrayidx2 = getelementptr inbounds [4 x [2 x %union.vect32]], ptr %Tmp, i32 0, i32 %0 
# | next:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:20'3              ?                                                                               possible intended match
# |           18:  store i32 %mul, ptr %arrayidx2, align 8, !tbaa !6 
# | next:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           19:  %arrayidx5 = getelementptr inbounds nuw i8, ptr %arrayidx, i32 4 
# | next:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           20:  %2 = load i32, ptr %arrayidx5, align 4, !tbaa !2 
# | next:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           21:  %mul6 = mul i32 %2, %Num 
# | next:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           22:  %arrayidx8 = getelementptr inbounds nuw i8, ptr %arrayidx2, i32 4 
# | next:20'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list