<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - IR dump prints win64cc but llc does not recognize it"
   href="https://bugs.llvm.org/show_bug.cgi?id=43207">43207</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>IR dump prints win64cc but llc does not recognize it
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows XP
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>LChrisman@Lumina.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>