mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-14 15:19:33 +00:00
[PRE] Preserve !invariant.load metadata
Spoted via inspection. Test case included. llvm-svn: 253275
This commit is contained in:
parent
ee15a8e627
commit
577e9b1072
@ -1669,6 +1669,8 @@ bool GVN::PerformLoadPRE(LoadInst *LI, AvailValInBlkVect &ValuesPerBlock,
|
||||
if (Tags)
|
||||
NewLoad->setAAMetadata(Tags);
|
||||
|
||||
if (auto *MD = LI->getMetadata(LLVMContext::MD_invariant_load))
|
||||
NewLoad->setMetadata(LLVMContext::MD_invariant_load, MD);
|
||||
if (auto *InvGroupMD = LI->getMetadata(LLVMContext::MD_invariant_group))
|
||||
NewLoad->setMetadata(LLVMContext::MD_invariant_group, InvGroupMD);
|
||||
|
||||
|
@ -114,6 +114,23 @@ entry:
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
define i32 @test8(i1 %cnd, i32* %p) {
|
||||
; CHECK-LABEL: test8
|
||||
; CHECK: @bar
|
||||
; CHECK: load i32, i32* %p2, !invariant.load
|
||||
; CHECK: br label %merge
|
||||
entry:
|
||||
%v1 = load i32, i32* %p, !invariant.load !0
|
||||
br i1 %cnd, label %taken, label %merge
|
||||
taken:
|
||||
%p2 = call i32* (...) @bar(i32* %p)
|
||||
br label %merge
|
||||
merge:
|
||||
%p3 = phi i32* [%p, %entry], [%p2, %taken]
|
||||
%v2 = load i32, i32* %p3, !invariant.load !0
|
||||
%res = sub i32 %v1, %v2
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
!0 = !{ }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user