summaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/InstCombine/neg-alloca.ll
blob: 96d41d7febfa9fcca018931f0b863bc41c5a16d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
; 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
}