1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
3 declare void @use(i32 *)
5 define void @foo(i64 %X) {
6 ; Currently we cannot handle expressions of the form Offset - X * Scale.
8 ; CHECK-NEXT: [[TMP1:%.*]] = mul nsw i64 [[X:%.*]], -4
9 ; CHECK-NEXT: [[TMP2:%.*]] = add nsw i64 [[TMP1]], 24
10 ; CHECK-NEXT: [[TMP3:%.*]] = alloca i8, i64 [[TMP2]], align 4
11 ; CHECK-NEXT: [[TMP4:%.*]] = bitcast i8* [[TMP3]] to i32*
12 ; CHECK-NEXT: call void @use(i32* nonnull [[TMP4]])
13 ; CHECK-NEXT: ret void
15 %1 = mul nsw i64 %X, -4
16 %2 = add nsw i64 %1, 24
17 %3 = alloca i8, i64 %2, align 4
18 %4 = bitcast i8* %3 to i32*
19 call void @use(i32 *%4)