@@ -336,6 +336,17 @@ static bool writtenBetween(MemorySSA *MSSA, BatchAAResults &AA,
336
336
return !MSSA->dominates (Clobber, Start);
337
337
}
338
338
339
+ // Update AA metadata
340
+ static void combineAAMetadata (Instruction *ReplInst, Instruction *I) {
341
+ // FIXME: MD_tbaa_struct and MD_mem_parallel_loop_access should also be
342
+ // handled here, but combineMetadata doesn't support them yet
343
+ unsigned KnownIDs[] = {LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
344
+ LLVMContext::MD_noalias,
345
+ LLVMContext::MD_invariant_group,
346
+ LLVMContext::MD_access_group};
347
+ combineMetadata (ReplInst, I, KnownIDs, true );
348
+ }
349
+
339
350
// / When scanning forward over instructions, we look for some other patterns to
340
351
// / fold away. In particular, this looks for stores to neighboring locations of
341
352
// / memory. If it sees enough consecutive ones, it attempts to merge them
@@ -1096,16 +1107,9 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpyLoad,
1096
1107
MSSA->getMemoryAccess (C));
1097
1108
}
1098
1109
1099
- // Update AA metadata
1100
- // FIXME: MD_tbaa_struct and MD_mem_parallel_loop_access should also be
1101
- // handled here, but combineMetadata doesn't support them yet
1102
- unsigned KnownIDs[] = {LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
1103
- LLVMContext::MD_noalias,
1104
- LLVMContext::MD_invariant_group,
1105
- LLVMContext::MD_access_group};
1106
- combineMetadata (C, cpyLoad, KnownIDs, true );
1110
+ combineAAMetadata (C, cpyLoad);
1107
1111
if (cpyLoad != cpyStore)
1108
- combineMetadata (C, cpyStore, KnownIDs, true );
1112
+ combineAAMetadata (C, cpyStore);
1109
1113
1110
1114
++NumCallSlot;
1111
1115
return true ;
@@ -1961,6 +1965,7 @@ bool MemCpyOptPass::processImmutArgument(CallBase &CB, unsigned ArgNo) {
1961
1965
<< " " << CB << " \n " );
1962
1966
1963
1967
// Otherwise we're good! Update the immut argument.
1968
+ combineAAMetadata (&CB, MDep);
1964
1969
CB.setArgOperand (ArgNo, MDep->getSource ());
1965
1970
++NumMemCpyInstr;
1966
1971
return true ;
0 commit comments