Skip to content

Commit 5c084a1

Browse files
authored
[InstCombine] Increase coverage of shuffle-gep (#139725)
There is an uncovered codepath in InstCombineVectorOps, where a new GEP instruction is created via buildNew. Fix this coverage hole.
1 parent bec038d commit 5c084a1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/test/Transforms/InstCombine/vec_shuffle.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,19 @@ define <2 x i8> @test13a(i8 %x1, i8 %x2) {
248248
ret <2 x i8> %D
249249
}
250250

251+
define <1 x ptr> @shuffle_gep(ptr %x1, ptr %x2) {
252+
; CHECK-LABEL: @shuffle_gep(
253+
; CHECK-NEXT: [[TMP1:%.*]] = insertelement <1 x ptr> poison, ptr [[X2:%.*]], i64 0
254+
; CHECK-NEXT: [[RET:%.*]] = getelementptr i8, <1 x ptr> [[TMP1]], i64 5
255+
; CHECK-NEXT: ret <1 x ptr> [[RET]]
256+
;
257+
%ins.1 = insertelement <2 x ptr> poison, ptr %x1, i32 0
258+
%ins.2 = insertelement <2 x ptr> %ins.1, ptr %x2, i32 1
259+
%gep = getelementptr i8, <2 x ptr> %ins.2, i64 5
260+
%ret = shufflevector <2 x ptr> %gep, <2 x ptr> poison, <1 x i32> <i32 1>
261+
ret <1 x ptr> %ret
262+
}
263+
251264
; Increasing length of vector ops is not a good canonicalization.
252265

253266
define <3 x i32> @add_wider(i32 %y, i32 %z) {

0 commit comments

Comments
 (0)