File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
IGC/AdaptorOCL/preprocess_spvir Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -582,7 +582,7 @@ GlobalVariable* PromoteBools::promoteGlobalVariable(GlobalVariable* globalVariab
582
582
return globalVariable;
583
583
}
584
584
585
- return new GlobalVariable (
585
+ auto newGlobalVariable = new GlobalVariable (
586
586
*globalVariable->getParent (),
587
587
getOrCreatePromotedType (IGCLLVM::getNonOpaquePtrEltTy (globalVariable->getType ())),
588
588
globalVariable->isConstant (),
@@ -592,6 +592,15 @@ GlobalVariable* PromoteBools::promoteGlobalVariable(GlobalVariable* globalVariab
592
592
nullptr ,
593
593
GlobalValue::ThreadLocalMode::NotThreadLocal,
594
594
globalVariable->getType ()->getPointerAddressSpace ());
595
+
596
+ // Clone metadatas
597
+ SmallVector<std::pair<unsigned , MDNode*>, 8 > metadatas;
598
+ globalVariable->getAllMetadata (metadatas);
599
+ for (const auto & metadata : metadatas)
600
+ {
601
+ newGlobalVariable->addMetadata (metadata.first , *metadata.second );
602
+ }
603
+ return newGlobalVariable;
595
604
}
596
605
597
606
Constant* PromoteBools::promoteConstant (Constant* constant)
You can’t perform that action at this time.
0 commit comments