mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	Don't remove the memcpy when call slot substitution fails.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -580,14 +580,19 @@ bool MemCpyOpt::performCallSlotOptzn(MemCpyInst *cpy, CallInst *C) { | |||||||
|     return false; |     return false; | ||||||
|  |  | ||||||
|   // All the checks have passed, so do the transformation. |   // All the checks have passed, so do the transformation. | ||||||
|  |   bool changedArgument = false; | ||||||
|   for (unsigned i = 0; i < CS.arg_size(); ++i) |   for (unsigned i = 0; i < CS.arg_size(); ++i) | ||||||
|     if (CS.getArgument(i) == cpySrc) { |     if (CS.getArgument(i) == cpySrc) { | ||||||
|       if (cpySrc->getType() != cpyDest->getType()) |       if (cpySrc->getType() != cpyDest->getType()) | ||||||
|         cpyDest = CastInst::CreatePointerCast(cpyDest, cpySrc->getType(), |         cpyDest = CastInst::CreatePointerCast(cpyDest, cpySrc->getType(), | ||||||
|                                               cpyDest->getName(), C); |                                               cpyDest->getName(), C); | ||||||
|  |       changedArgument = true; | ||||||
|       CS.setArgument(i, cpyDest); |       CS.setArgument(i, cpyDest); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |   if (!changedArgument) | ||||||
|  |     return false; | ||||||
|  |  | ||||||
|   // Drop any cached information about the call, because we may have changed |   // Drop any cached information about the call, because we may have changed | ||||||
|   // its dependence information by changing its parameter. |   // its dependence information by changing its parameter. | ||||||
|   MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>(); |   MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user