20 lines
650 B
LLVM
20 lines
650 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
|
|
declare void @use(ptr)
|
|
|
|
define void @foo(i64 %X) {
|
|
; Currently we cannot handle expressions of the form Offset - X * Scale.
|
|
; CHECK-LABEL: @foo(
|
|
; CHECK-NEXT: [[TMP1:%.*]] = shl i64 [[X:%.*]], 2
|
|
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 24, [[TMP1]]
|
|
; CHECK-NEXT: [[TMP3:%.*]] = alloca i8, i64 [[TMP2]], align 4
|
|
; CHECK-NEXT: call void @use(ptr nonnull [[TMP3]])
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
%1 = mul nsw i64 %X, -4
|
|
%2 = add nsw i64 %1, 24
|
|
%3 = alloca i8, i64 %2, align 4
|
|
call void @use(ptr %3)
|
|
ret void
|
|
}
|