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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to