Skip to content

Commit 2b9c158

Browse files
committed
[InstCombine] Add test for miscompile in gep-of-gep fold (NFC)
1 parent c28566c commit 2b9c158

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llvm/test/Transforms/InstCombine/getelementptr.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,4 +1680,15 @@ if.else:
16801680
ret i64 0
16811681
}
16821682

1683+
1684+
@g = external global i8
1685+
1686+
; FIXME: This is a miscompile
1687+
define ptr @constexpr_gep_of_gep_with_narrow_type() {
1688+
; CHECK-LABEL: @constexpr_gep_of_gep_with_narrow_type(
1689+
; CHECK-NEXT: ret ptr getelementptr (i8, ptr @g, i64 -2)
1690+
;
1691+
ret ptr getelementptr (i8, ptr getelementptr (i8, ptr @g, i8 127), i8 127)
1692+
}
1693+
16831694
!0 = !{!"branch_weights", i32 2, i32 10}

0 commit comments

Comments
 (0)