@@ -185,10 +185,10 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
185185
186186 // If the memcpy has metadata describing the members, see if we can get the
187187 // TBAA tag describing our copy.
188- MDNode *CopyMD = nullptr ;
189- if (MDNode *M = MI-> getMetadata (LLVMContext::MD_tbaa)) {
190- CopyMD = M;
191- } else if (MDNode *M = MI-> getMetadata (LLVMContext::MD_tbaa_struct)) {
188+ AAMDNodes AACopyMD = MI-> getAAMetadata () ;
189+
190+ if (MDNode *M = AACopyMD. TBAAStruct ) {
191+ AACopyMD. TBAAStruct = nullptr ;
192192 if (M->getNumOperands () == 3 && M->getOperand (0 ) &&
193193 mdconst::hasa<ConstantInt>(M->getOperand (0 )) &&
194194 mdconst::extract<ConstantInt>(M->getOperand (0 ))->isZero () &&
@@ -197,16 +197,15 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
197197 mdconst::extract<ConstantInt>(M->getOperand (1 ))->getValue () ==
198198 Size &&
199199 M->getOperand (2 ) && isa<MDNode>(M->getOperand (2 )))
200- CopyMD = cast<MDNode>(M->getOperand (2 ));
200+ AACopyMD. TBAA = cast<MDNode>(M->getOperand (2 ));
201201 }
202202
203203 Value *Src = Builder.CreateBitCast (MI->getArgOperand (1 ), NewSrcPtrTy);
204204 Value *Dest = Builder.CreateBitCast (MI->getArgOperand (0 ), NewDstPtrTy);
205205 LoadInst *L = Builder.CreateLoad (IntType, Src);
206206 // Alignment from the mem intrinsic will be better, so use it.
207207 L->setAlignment (*CopySrcAlign);
208- if (CopyMD)
209- L->setMetadata (LLVMContext::MD_tbaa, CopyMD);
208+ L->setAAMetadata (AACopyMD);
210209 MDNode *LoopMemParallelMD =
211210 MI->getMetadata (LLVMContext::MD_mem_parallel_loop_access);
212211 if (LoopMemParallelMD)
@@ -218,8 +217,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
218217 StoreInst *S = Builder.CreateStore (L, Dest);
219218 // Alignment from the mem intrinsic will be better, so use it.
220219 S->setAlignment (*CopyDstAlign);
221- if (CopyMD)
222- S->setMetadata (LLVMContext::MD_tbaa, CopyMD);
220+ S->setAAMetadata (AACopyMD);
223221 if (LoopMemParallelMD)
224222 S->setMetadata (LLVMContext::MD_mem_parallel_loop_access, LoopMemParallelMD);
225223 if (AccessGroupMD)
0 commit comments