[LLVMbugs] [Bug 24065] New: CloneFunction ovewrites requested replacements - PATCH
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jul 8 08:30:13 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24065
Bug ID: 24065
Summary: CloneFunction ovewrites requested replacements - PATCH
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Transformation Utilities
Assignee: unassignedbugs at nondot.org
Reporter: pedro.ferreira at imgtec.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The utility "CloneFunction" provides a ValueMap to describe requested
replacements of the cloned function's Values. When the cloning process goes
through the functions, it unconditionally adds the cloned instruction as a
replacement to the original.
The attached patch checks that a Value has not yet specified to replace and
instruction before adding such entry to the map.
We are not sure if this was the originally intended behaviour though and
therefore don't know if this is indeed a bug:
$ svn diff lib/Transforms/Utils/CloneFunction.cpp
Index: lib/Transforms/Utils/CloneFunction.cpp
===================================================================
--- lib/Transforms/Utils/CloneFunction.cpp (revision 241669)
+++ lib/Transforms/Utils/CloneFunction.cpp (working copy)
@@ -51,7 +51,8 @@
if (II->hasName())
NewInst->setName(II->getName()+NameSuffix);
NewBB->getInstList().push_back(NewInst);
- VMap[II] = NewInst; // Add instruction map to value.
+ if (VMap.find(II) == VMap.end())
+ VMap[II] = NewInst; // Add instruction map to value.
hasCalls |= (isa<CallInst>(II) && !isa<DbgInfoIntrinsic>(II));
if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) {
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150708/5fd336cc/attachment.html>
More information about the llvm-bugs
mailing list