blob: 13e5afc5dade53271159ff8849a2078e54d8f606 [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
declare void @use(i32 *)
define void @foo(i64 %X) {
; Currently we cannot handle expressions of the form Offset - X * Scale.
; CHECK-LABEL: @foo(
; CHECK-NEXT: [[TMP1:%.*]] = mul nsw i64 [[X:%.*]], -4
; CHECK-NEXT: [[TMP2:%.*]] = add nsw i64 [[TMP1]], 24
; CHECK-NEXT: [[TMP3:%.*]] = alloca i8, i64 [[TMP2]], align 4
; CHECK-NEXT: [[TMP4:%.*]] = bitcast i8* [[TMP3]] to i32*
; CHECK-NEXT: call void @use(i32* nonnull [[TMP4]])
; CHECK-NEXT: ret void
;
%1 = mul nsw i64 %X, -4
%2 = add nsw i64 %1, 24
%3 = alloca i8, i64 %2, align 4
%4 = bitcast i8* %3 to i32*
call void @use(i32 *%4)
ret void
}