1
; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s
3
declare i32* @test(i32* nocapture)
8
%Q = call i32* @test(i32* %P)
10
store i32 4, i32* %Q ;; cannot clobber P since it is nocapture.
11
%b = load i32, i32* %P
16
declare void @test3(i32** %p, i32* %q) nounwind
18
define i32 @test4(i32* noalias nocapture %p) nounwind {
19
; CHECK: call void @test3
20
; CHECK: store i32 0, i32* %p
21
; CHECK: store i32 1, i32* %x
22
; CHECK: %y = load i32, i32* %p
26
; Here test3 might store %p to %q. This doesn't violate %p's nocapture
27
; attribute since the copy doesn't outlive the function.
28
call void @test3(i32** %q, i32* %p) nounwind
30
%x = load i32*, i32** %q
31
; This store might write to %p and so we can't eliminate the subsequent
34
%y = load i32, i32* %p