[all-commits] [llvm/llvm-project] 111af7: [DirectX] add Function name to DiagnosticInfoUnsup...

Farzon Lotfi via All-commits all-commits at lists.llvm.org
Mon Apr 21 07:26:48 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 111af76bd74708929a048f94ef5c52af646f1c64
      https://github.com/llvm/llvm-project/commit/111af76bd74708929a048f94ef5c52af646f1c64
  Author: Farzon Lotfi <farzonlotfi at microsoft.com>
  Date:   2025-04-21 (Mon, 21 Apr 2025)

  Changed paths:
    A clang/test/CodeGenDirectX/unsupported_intrinsic.hlsl
    M llvm/lib/Target/DirectX/DXILOpLowering.cpp
    M llvm/test/CodeGen/DirectX/unsupported_intrinsic.ll

  Log Message:
  -----------
  [DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering (#136234)

fixes #135654

In #128613 we added safe guards to prevent the lowering of just any
intrinsic in the backend. We used `DiagnosticInfoUnsupported` to do
this.

What we found was when using `opt` the diagnostic print function was
called but when using clang the diagnostic message was used.

Printing message in the clang version means we miss valuable debugging
information like function name and function type when LLVMContext was
only needed to call `getBestLocationFromDebugLoc`.

There are a few potential fixes

1. Write a custom DiagnosticInfoUnsupported so we can change the Message
just for DirectX. Too heavy handed so rejected.

2. Add the function name to the Message in DirectX code. Very simple one
line change. Downside is when using opt you see the function name twice.
But makes the clang-dxc bugs more actionable.

3. change CodeGenAction.cpp to always use the print function and not the
message directly. Downside is a bunch of innacurate information shows up
in the message if you don't specify `-debug-info-kind=standalone`.

4. add some book keeping to know which function called the intrinsic
keep a map of these so we can pass the calling function to
`DiagnosticInfoUnsupported` instead of the intrinsic. This would only be
useful if we had debug info so we could distinguish different uses of
the intrinsic by line\col number. We would also need to change from
iterating on every function to doing something like a LazyCallGraph
which is a nonstarter.

5. pick a different means of doing a Diagnostic error, because other
uses of `DiagnosticInfoUnsupported` error when we are in the body of a
function not when we see one being used like in the intrinsic case.

This PR went with a combo of option 2 & 5. Its low code change that also
only impacts the DirectX backend.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list