[all-commits] [llvm/llvm-project] fcfd3f: [OpenCL] Respect calling convention for builtin

ldrumm via All-commits all-commits at lists.llvm.org
Mon Mar 15 10:27:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fcfd3fda71905d7c48f75a531c2265ad3b9876ea
      https://github.com/llvm/llvm-project/commit/fcfd3fda71905d7c48f75a531c2265ad3b9876ea
  Author: Luke Drummond <luke.drummond at codeplay.com>
  Date:   2021-03-15 (Mon, 15 Mar 2021)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGenOpenCL/sampler.cl

  Log Message:
  -----------
  [OpenCL] Respect calling convention for builtin

`__translate_sampler_initializer` has a calling convention of
`spir_func`, but clang generated calls to it using the default CC.

Instruction Combining was lowering these mismatching calling conventions
to `store i1* undef` which itself was subsequently lowered to a trap
instruction by simplifyCFG resulting in runtime `SIGILL`

There are arguably two bugs here: but whether there's any wisdom in
converting an obviously invalid call into a runtime crash over aborting
with a sensible error message will require further discussion. So for
now it's enough to set the right calling convention on the runtime
helper.

Reviewed By: svenh, bader

Differential Revision: https://reviews.llvm.org/D98411




More information about the All-commits mailing list