Files
clang-p2996/llvm/test/Transforms/Attributor/ArgumentPromotion/alignment.ll
Johannes Doerfert 89c2e733e8 [Attributor] Pointer privatization attribute (argument promotion)
A pointer is privatizeable if it can be replaced by a new, private one.
Privatizing pointer reduces the use count, interaction between unrelated
code parts. This is a first step towards replacing argument promotion.
While we can already handle recursion (unlike argument promotion!) we
are restricted to stack allocations for now because we do not analyze
the uses in the callee.

Reviewed By: uenoku

Differential Revision: https://reviews.llvm.org/D68852
2020-01-29 21:31:04 -06:00

33 lines
1.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
; RUN: opt -S -passes='attributor' -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=2 < %s | FileCheck %s
define void @f() {
; CHECK-LABEL: define {{[^@]+}}@f()
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 1
; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[A]], align 1
; CHECK-NEXT: call void @g(i32 [[TMP0]])
; CHECK-NEXT: ret void
;
entry:
%a = alloca i32, align 1
call void @g(i32* %a)
ret void
}
define internal void @g(i32* %a) {
; CHECK-LABEL: define {{[^@]+}}@g
; CHECK-SAME: (i32 [[TMP0:%.*]])
; CHECK-NEXT: [[A_PRIV:%.*]] = alloca i32
; CHECK-NEXT: store i32 [[TMP0]], i32* [[A_PRIV]]
; CHECK-NEXT: [[AA:%.*]] = load i32, i32* [[A_PRIV]], align 1
; CHECK-NEXT: call void @z(i32 [[AA]])
; CHECK-NEXT: ret void
;
%aa = load i32, i32* %a, align 1
call void @z(i32 %aa)
ret void
}
declare void @z(i32)