[llvm-bugs] [Bug 43202] New: ARM FastIsel is renaming the memcpy to memcpy.<random-number> in getLibcallReg().

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 2 23:07:55 PDT 2019


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

            Bug ID: 43202
           Summary: ARM FastIsel  is renaming the memcpy to
                    memcpy.<random-number> in getLibcallReg().
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: umesh.kalappa0 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

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

The attached file compiled like 

clang --target=arm-linux-eabi -mcpu=cortex-a9  -w -fno-builtin  -mlong-calls
testcase.cpp -c; nm testcase.o | grep memcpy
         U memcpy
         U memcpy.202
         U memcpy.203
         U memcpy.204

results with linker  undefined symbols error .

When we investigated why the codegen renames it ,the following code
ARMFastISel.cpp @ getLibcallReg  do so.

>>GlobalValue *GV = new GlobalVariable(M, Type::getInt32Ty(*Context), false,
                                        GlobalValue::ExternalLinkage, nullptr,
                                        Name);

where "Name=memcpy" in this case and GlobalVariable creates new instance with
"Name" if doesn't exist in the module table ,else its renames with appending
the random number to "Name".

But its not the semantics we required here ,hence we modified the code like 

>>GlobalValue *GV = cast <GlobalVariable>(M.getOrInsertGlobal(Name.getSingleStringRef(), Type::getInt32Ty(*Context)));

where we used Module.getOrInsertGlobal () instead and getOrInsertGlobal()
creates new instance with "Name" if doesn't exist ,else returns the exist one .

-- 
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/20190903/c2b93550/attachment.html>


More information about the llvm-bugs mailing list