@@ -332,6 +332,17 @@ static bool writtenBetween(MemorySSA *MSSA, BatchAAResults &AA,
332
332
return !MSSA->dominates (Clobber, Start);
333
333
}
334
334
335
+ // Update AA metadata
336
+ static void combineAAMetadata (Instruction *ReplInst, Instruction *I) {
337
+ // FIXME: MD_tbaa_struct and MD_mem_parallel_loop_access should also be
338
+ // handled here, but combineMetadata doesn't support them yet
339
+ unsigned KnownIDs[] = {LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
340
+ LLVMContext::MD_noalias,
341
+ LLVMContext::MD_invariant_group,
342
+ LLVMContext::MD_access_group};
343
+ combineMetadata (ReplInst, I, KnownIDs, true );
344
+ }
345
+
335
346
// / When scanning forward over instructions, we look for some other patterns to
336
347
// / fold away. In particular, this looks for stores to neighboring locations of
337
348
// / memory. If it sees enough consecutive ones, it attempts to merge them
@@ -1086,16 +1097,9 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
1086
1097
MSSA->getMemoryAccess (C));
1087
1098
}
1088
1099
1089
- // Update AA metadata
1090
- // FIXME: MD_tbaa_struct and MD_mem_parallel_loop_access should also be
1091
- // handled here, but combineMetadata doesn't support them yet
1092
- unsigned KnownIDs[] = {LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
1093
- LLVMContext::MD_noalias,
1094
- LLVMContext::MD_invariant_group,
1095
- LLVMContext::MD_access_group};
1096
- combineMetadata (C, cpyLoad, KnownIDs, true );
1100
+ combineAAMetadata (C, cpyLoad);
1097
1101
if (cpyLoad != cpyStore)
1098
- combineMetadata (C, cpyStore, KnownIDs, true );
1102
+ combineAAMetadata (C, cpyStore);
1099
1103
1100
1104
++NumCallSlot;
1101
1105
return true ;
@@ -1694,6 +1698,7 @@ bool MemCpyOptPass::processImmutArgument(CallBase &CB, unsigned ArgNo) {
1694
1698
<< " " << CB << " \n " );
1695
1699
1696
1700
// Otherwise we're good! Update the immut argument.
1701
+ combineAAMetadata (&CB, MDep);
1697
1702
CB.setArgOperand (ArgNo, MDep->getSource ());
1698
1703
++NumMemCpyInstr;
1699
1704
return true ;
0 commit comments