[IRMover] Don't copy personality, etc unless creating def
authorTeresa Johnson <tejohnson@google.com>
Tue, 12 Jan 2016 00:24:24 +0000 (00:24 +0000)
committerTeresa Johnson <tejohnson@google.com>
Tue, 12 Jan 2016 00:24:24 +0000 (00:24 +0000)
commit132f8670a3b60601ac94b30b8a19f748f060fc46
treec1e7bcda9b0611ae805603f6119253515c1d60ac
parent6a7de42ac6929eb1b71f6a6582eff716ef1d954e
[IRMover] Don't copy personality, etc unless creating def

Function::copyAttributesFrom will copy the personality function, prefix
data and prolog data from the source function to the new function, and
is invoked when the IRMover copies the function prototype. This puts a
reference to a constant in the source module on a function in the dest
module, which causes an error when deleting the source module after
importing, since the personality function in the source module still has
uses (this would presumably also be an issue for the prologue and prefix
data). Remove the copies added to the dest copy when creating the new
prototype, as they are mapped properly when/if we link the function body.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257420 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Linker/IRMover.cpp
test/Transforms/FunctionImport/Inputs/funcimport.ll
test/Transforms/FunctionImport/funcimport.ll