File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -4470,6 +4470,11 @@ void Verifier::visitInstruction(Instruction &I) {
4470
4470
visitRangeMetadata (I, Range, I.getType ());
4471
4471
}
4472
4472
4473
+ if (I.hasMetadata (LLVMContext::MD_invariant_group)) {
4474
+ Assert (isa<LoadInst>(I) || isa<StoreInst>(I),
4475
+ " invariant.group metadata is only for loads and stores" , &I);
4476
+ }
4477
+
4473
4478
if (I.getMetadata (LLVMContext::MD_nonnull)) {
4474
4479
Assert (I.getType ()->isPointerTy (), " nonnull applies only to pointer types" ,
4475
4480
&I);
Original file line number Diff line number Diff line change
1
+ ; RUN: not opt -passes=verify -disable-output < %s 2>&1 | FileCheck %s
2
+
3
+ ; CHECK: invariant.group metadata is only for loads and stores
4
+ ; CHECK-NEXT: alloca
5
+ ; CHECK-NEXT: invariant.group metadata is only for loads and stores
6
+ ; CHECK-NEXT: ret void
7
+ define void @f () {
8
+ %a = alloca i32 , !invariant.group !0
9
+ %b = load i32 , i32* %a , !invariant.group !0
10
+ store i32 43 , i32* %a , !invariant.group !0
11
+ ret void , !invariant.group !0
12
+ }
13
+
14
+ !0 = !{}
You can’t perform that action at this time.
0 commit comments