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