[llvm-bugs] [Bug 43207] New: IR dump prints win64cc but llc does not recognize it

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 3 08:41:34 PDT 2019


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

            Bug ID: 43207
           Summary: IR dump prints win64cc but llc does not recognize it
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: LChrisman at Lumina.com
                CC: llvm-bugs at lists.llvm.org

You can produce an IR dump with a win64cc calling convention, like this one:

%MyStruct = type { i16, i64 }
define win64cc %MyStruct @ret_struct() {
begin:
  ret %MyStruct { i16 13, i64 23 }
}

But when you compile it with llc, it gives an error that it doesn't recognize
it. If it can print it, it seems like it should parse it.

Steps: 
1. Same the above to win64cctest.ll
2. On command line, run: llc win64cctest.ll -o -
{ Actual: error: expected type. Points to win64cc }
{ Expected: Would succeed }

---
Printing side:

ThreadSafeModule MakeM()
{
        auto pCtx = make_unique<LLVMContext>();
        auto& ctx = *pCtx;
        auto pM = make_unique<Module>("My_module",ctx);
        auto& M = *pM;

        auto myStruct = StructType::create(ctx,
                {       Type::getInt16Ty(ctx),
                        Type::getInt64Ty(ctx)
                },"MyStruct");
        FunctionType* proto = FunctionType::get(myStruct,false);
        Function* fn =
Function::Create(proto,GlobalValue::LinkageTypes::CommonLinkage,"ret_struct",M);
        fn->setCallingConv(CallingConv::Win64);
        BasicBlock* BB = BasicBlock::Create(ctx,"begin",fn);
        IRBuilder<> builder(BB);
        //Value* ms = builder.CreateAlloca(myStruct,nullptr,"ms");
        auto ms = ConstantStruct::get(myStruct,
                {       ConstantInt::get(ctx,APInt(16,13,true)), 
                        ConstantInt::get(ctx,APInt(64,23uLL)) 
                } );
        builder.CreateRet(ms);
        cout << "The IR is:\n";
        outs() << M;
        cout << endl;

        return ThreadSafeModule(std::move(pM),std::move(pCtx));
}

int main()
{
        InitializeNativeTarget();
        InitializeNativeTargetAsmPrinter();

        auto M = MakeM();
...
}


--------------
Additional comments:
* Using most recent SVN branch, reproduced both on Win 7 and Win 10.  (Your bug
base OS pulldown doesn't have anything after Windows XP)

-- 
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/c662c32a/attachment-0001.html>


More information about the llvm-bugs mailing list