mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Add handling of !invariant.load to PropagateMetadata.
Summary: This will let e.g. the load/store vectorizer propagate this metadata appropriately. Reviewers: arsenm Subscribers: tra, jholewinski, hfinkel, mzolotukhin Differential Revision: https://reviews.llvm.org/D23479 llvm-svn: 281153
This commit is contained in:
parent
1c4f697044
commit
2c71fc8bb7
@ -454,9 +454,10 @@ Instruction *llvm::propagateMetadata(Instruction *Inst, ArrayRef<Value *> VL) {
|
||||
SmallVector<std::pair<unsigned, MDNode *>, 4> Metadata;
|
||||
I0->getAllMetadataOtherThanDebugLoc(Metadata);
|
||||
|
||||
for (auto Kind : { LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
|
||||
LLVMContext::MD_noalias, LLVMContext::MD_fpmath,
|
||||
LLVMContext::MD_nontemporal }) {
|
||||
for (auto Kind :
|
||||
{LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
|
||||
LLVMContext::MD_noalias, LLVMContext::MD_fpmath,
|
||||
LLVMContext::MD_nontemporal, LLVMContext::MD_invariant_load}) {
|
||||
MDNode *MD = I0->getMetadata(Kind);
|
||||
|
||||
for (int J = 1, E = VL.size(); MD && J != E; ++J) {
|
||||
@ -469,13 +470,12 @@ Instruction *llvm::propagateMetadata(Instruction *Inst, ArrayRef<Value *> VL) {
|
||||
case LLVMContext::MD_alias_scope:
|
||||
MD = MDNode::getMostGenericAliasScope(MD, IMD);
|
||||
break;
|
||||
case LLVMContext::MD_noalias:
|
||||
MD = MDNode::intersect(MD, IMD);
|
||||
break;
|
||||
case LLVMContext::MD_fpmath:
|
||||
MD = MDNode::getMostGenericFPMath(MD, IMD);
|
||||
break;
|
||||
case LLVMContext::MD_noalias:
|
||||
case LLVMContext::MD_nontemporal:
|
||||
case LLVMContext::MD_invariant_load:
|
||||
MD = MDNode::intersect(MD, IMD);
|
||||
break;
|
||||
default:
|
||||
|
@ -0,0 +1,17 @@
|
||||
; RUN: opt -load-store-vectorizer -march=nvptx64 -mcpu=sm_35 -S < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
|
||||
target triple = "nvptx64-nvidia-cuda"
|
||||
|
||||
; CHECK-LABEL: @foo
|
||||
define i32 @foo(i32* %ptr) {
|
||||
%ptr1 = getelementptr i32, i32* %ptr, i32 1
|
||||
%p1 = addrspacecast i32* %ptr1 to i32 addrspace(1)*
|
||||
; CHECK: load <2 x i32>, <2 x i32>* %{{[0-9]+}}, align 8, !invariant.load !0
|
||||
%v0 = load i32, i32* %ptr, align 8, !invariant.load !0
|
||||
%v1 = load i32, i32* %ptr1, align 4, !invariant.load !0
|
||||
%sum = add i32 %v0, %v1
|
||||
ret i32 %sum
|
||||
}
|
||||
|
||||
!0 = !{}
|
Loading…
Reference in New Issue
Block a user