@@ -185,10 +185,10 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
185
185
186
186
// If the memcpy has metadata describing the members, see if we can get the
187
187
// 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 ;
192
192
if (M->getNumOperands () == 3 && M->getOperand (0 ) &&
193
193
mdconst::hasa<ConstantInt>(M->getOperand (0 )) &&
194
194
mdconst::extract<ConstantInt>(M->getOperand (0 ))->isZero () &&
@@ -197,16 +197,15 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
197
197
mdconst::extract<ConstantInt>(M->getOperand (1 ))->getValue () ==
198
198
Size &&
199
199
M->getOperand (2 ) && isa<MDNode>(M->getOperand (2 )))
200
- CopyMD = cast<MDNode>(M->getOperand (2 ));
200
+ AACopyMD. TBAA = cast<MDNode>(M->getOperand (2 ));
201
201
}
202
202
203
203
Value *Src = Builder.CreateBitCast (MI->getArgOperand (1 ), NewSrcPtrTy);
204
204
Value *Dest = Builder.CreateBitCast (MI->getArgOperand (0 ), NewDstPtrTy);
205
205
LoadInst *L = Builder.CreateLoad (IntType, Src);
206
206
// Alignment from the mem intrinsic will be better, so use it.
207
207
L->setAlignment (*CopySrcAlign);
208
- if (CopyMD)
209
- L->setMetadata (LLVMContext::MD_tbaa, CopyMD);
208
+ L->setAAMetadata (AACopyMD);
210
209
MDNode *LoopMemParallelMD =
211
210
MI->getMetadata (LLVMContext::MD_mem_parallel_loop_access);
212
211
if (LoopMemParallelMD)
@@ -218,8 +217,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
218
217
StoreInst *S = Builder.CreateStore (L, Dest);
219
218
// Alignment from the mem intrinsic will be better, so use it.
220
219
S->setAlignment (*CopyDstAlign);
221
- if (CopyMD)
222
- S->setMetadata (LLVMContext::MD_tbaa, CopyMD);
220
+ S->setAAMetadata (AACopyMD);
223
221
if (LoopMemParallelMD)
224
222
S->setMetadata (LLVMContext::MD_mem_parallel_loop_access, LoopMemParallelMD);
225
223
if (AccessGroupMD)
0 commit comments