[LLVMbugs] [Bug 23992] New: CloneModule does not remap personality of a function correctly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 30 03:22:56 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23992

            Bug ID: 23992
           Summary: CloneModule does not remap personality of a function
                    correctly
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedbugs at nondot.org
          Reporter: tom.aernoudt at synopsys.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14537
  --> https://llvm.org/bugs/attachment.cgi?id=14537&action=edit
testcase

It looks like the CloneModule utility function does not remap the personality
operand of a function correctly.

After cloning the module following assert is triggered when printing the module
with module->print(llvm::outs(), 0, true):

testCloneModule:
/localdev/aernoudt/programs/llvm/git/llvm/lib/IR/AsmWriter.cpp:203: void
predictValueUseListOrder(const llvm::Value*, const llvm::Function*,
{anonymous}::OrderMap&, llvm::UseListOrderStack&): Assertion `IDPair.first &&
"Unmapped value"' failed.

The unmapped value is the personality operand of the function testFunction.

The issue can be reproduced with the attached testcase (on a debug build of
llvm):

> clang++ -c -O3 -std=c++11 -emit-llvm -o test.bc test.cc
> g++ `llvm-config --cxxflags` -o testCloneModule testCloneModule.cc `llvm-config --ldflags` `llvm-config --system-libs --libs core ipo bitreader irreader` 
> ./cloneModule

--> Fail: assert triggered

Disabling exceptions, which removes the personality operand of the function
testFunction makes the test pass:

> clang++ -c -O3 -std=c++11 -emit-llvm -DNO_EXCEPTIONS -fno-exceptions -o test.bc test.cc
> g++ `llvm-config --cxxflags` -o testCloneModule testCloneModule.cc `llvm-config --ldflags` `llvm-config --system-libs --libs core ipo bitreader irreader` 
> ./cloneModule

--> Ok

-- 
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/20150630/4b5cc9fb/attachment.html>


More information about the llvm-bugs mailing list