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

ldrumm via All-commits all-commits at lists.llvm.org
Mon May 3 17:32:57 PDT 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: e0fe1c58acfa0bde36afde8354cb31fc1e0b75e2
      https://github.com/llvm/llvm-project/commit/e0fe1c58acfa0bde36afde8354cb31fc1e0b75e2
  Author: Luke Drummond <luke.drummond at codeplay.com>
  Date:   2021-05-03 (Mon, 03 May 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

(cherry picked from commit fcfd3fda71905d7c48f75a531c2265ad3b9876ea)




More information about the All-commits mailing list