[PATCH] D34997: Keep metadata when changing Invoke instructions to Call ones

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 00:14:42 PDT 2017


yrouban created this revision.

Metadata of invoke instructions get lost after SimplifyCFGPass.
Turning invokes that call 'nounwind' functions into ordinary calls the method changeToCall()
does not move or copy metadata from the source invoke instruction to the new call instruction.
This patch copies the metadata in changeToCall().


https://reviews.llvm.org/D34997

Files:
  lib/Transforms/Utils/Local.cpp


Index: lib/Transforms/Utils/Local.cpp
===================================================================
--- lib/Transforms/Utils/Local.cpp
+++ lib/Transforms/Utils/Local.cpp
@@ -1431,6 +1431,7 @@
   NewCall->setCallingConv(II->getCallingConv());
   NewCall->setAttributes(II->getAttributes());
   NewCall->setDebugLoc(II->getDebugLoc());
+  NewCall->copyMetadata(*II);
   II->replaceAllUsesWith(NewCall);
 
   // Follow the call by a branch to the normal destination.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34997.105223.patch
Type: text/x-patch
Size: 470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170705/3f62aec3/attachment-0001.bin>


More information about the llvm-commits mailing list