Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoBump] Merge with 02654f73 (Aug 30) (18) #371

Open
wants to merge 99 commits into
base: bump_to_54916e57
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
d6dc7cf
Fix bazel build past 89e6a288674c (#106685)
dklimkin Aug 30, 2024
0722b8a
[Clang][NFC] Consolidate tests for default argument substitution (#10…
zyn0217 Aug 30, 2024
5b77e25
[LoongArch] Pre-commit test for immediate value materialization using…
wangleiat Aug 30, 2024
eaf87d3
[LoongArch] Optimize for immediate value materialization using BSTRIN…
wangleiat Aug 27, 2024
8f4aafb
[RISCV][NFC] Splits f16 cast tests into a separate file (#106692)
arcbbb Aug 30, 2024
b294951
[clang][bytecode] Fix the handling of address of a vector (#106558)
yronglin Aug 30, 2024
1b32c3e
Add no-op handing for HLSLAttributedResource switch cases (#106698)
dklimkin Aug 30, 2024
a2a93f0
[clang] Cleanup IncludeLocMap (#106241)
kadircet Aug 30, 2024
c4b5cb0
[AArch64] Add accelerate test coverage for acos/asin/atan and cosh/si…
RKSimon Aug 30, 2024
833ce5d
[mlir][ArmSME] Fix test after #98043 (NFC)
MacDue Aug 30, 2024
c8568f0
[mlir][tosa] Add missing check for mutiples of `tosa.tile` (#106337)
CoTinker Aug 30, 2024
f0e34f3
[VPlan] Don't skip optimizable truncs in planContainsAdditionalSimps.
fhahn Aug 30, 2024
fab9256
[LLVM][AArch64] Fix invalid use of AArch64ISD::UZP2 in performConcatV…
paulwalker-arm Aug 30, 2024
68d8b38
[builtins] Fix missing main() function in float16/bfloat16 support ch…
overmighty Aug 30, 2024
b065ec0
[Inline][X86] Regenerate inline-target-cpu-* tests
RKSimon Aug 30, 2024
fda7649
[InstCombine][X86] Split off vperm shuffle tests from other avx512 tests
RKSimon Aug 30, 2024
6345604
Revert: [AMDGPU] Graph-based Module Splitting Rewrite (llvm#104763) (…
dklimkin Aug 30, 2024
2d5613a
[dsymutil] return EXIT_FAILURE when Crashed (#106619)
rmaz Aug 30, 2024
87a988e
[SLP]Fix PR106655: Use FinalShuffle for alternate cast nodes.
alexey-bataev Aug 30, 2024
ce5620b
[LLVM][VPlan] Pick more optimal initial value for VPBlend. (#104019)
paulwalker-arm Aug 30, 2024
64f1995
Fix stack overflow in allPathsGoThroughCold past 6b11573b8c5e (#106384)
dklimkin Aug 30, 2024
ceb613a
[RISCV] Add full test coverage for acos/asin/atan and cosh/sinh/tanh …
RKSimon Aug 30, 2024
8586d03
[flang] Don't generate empty else blocks (#106618)
vdonaldson Aug 30, 2024
2a8fda4
LICM: extend hoistAddSub to unsigned case (#106373)
artagnon Aug 30, 2024
86a60e7
[AVR] Fix parsing & emitting relative jumps (#106722)
Patryk27 Aug 30, 2024
a919588
[compiler-rt][rtsan] NFC: Rename rtsan_on->rtsan_enable rtsan_off->rt…
cjappl Aug 30, 2024
7ffe67c
[RemoveDIs] Fix asan-identified leak in unittest (#106723)
OCHyams Aug 30, 2024
4a10b4c
[flang] fix flang builds with clang 20 after #100692 (#106718)
jeanPerier Aug 30, 2024
96ad495
[SLP] vectorizeChainsInBlock - remove superfluous continue at the end…
RKSimon Aug 30, 2024
b719c92
[SLP] findBestRootPair - fix incorrect argument name comment. NFC.
RKSimon Aug 30, 2024
362d37a
Update clang tidy Contributing guide (#106672)
MichelleCDjunaidi Aug 30, 2024
2497739
[AArch64][AsmParser] Directives should clear transitively implied fea…
labrinea Aug 30, 2024
c792de2
[libcxx][test] Add macro for when long double is just double (#106708)
DavidSpickett Aug 30, 2024
f4ea19b
[libc++][syncbuf] Implement LWG3253 (#99778)
mordante Aug 30, 2024
ab40ae8
[lldb] Store SupportFiles in SourceManager::File (NFC) (#106639)
JDevlieghere Aug 30, 2024
b0eefb4
[lldb] Update SupportFile documentation (NFC)
JDevlieghere Aug 29, 2024
0c4cf79
[clang] Install scan-build-py into plain "lib" directory (#106612)
mgorny Aug 29, 2024
369d814
[ValueTracking] use KnownBits to compute fpclass from bitcast (#97762)
AlexMaclean Aug 30, 2024
c4a5381
[test-suite] Document the LLVM test-suite benchmark apps (#105843)
sjoerdmeijer Aug 30, 2024
ece6566
[MLIR][NVVM] Add support for fence.proxy.{acquire, release} Ops (#106…
schwarzschild-radius Aug 30, 2024
fef3426
Revert "[LLVM][rtsan] Add LLVM nosanitize_realtime attribute (#105447…
cjappl Aug 30, 2024
82a5ab7
[X86] x86-vperm.ll - strip superfluous semicolon check lines. NFC.
RKSimon Aug 30, 2024
d01e0f7
[InstCombine][X86] Add vpermv/vpermv3 test coverage for #106413
RKSimon Aug 30, 2024
a3816b5
[AVR] Fix LLD test (#106739)
Patryk27 Aug 30, 2024
924907b
[DAG] Prefer 0.0 over -0.0 as neutral value for FADD w/NoSignedZero (…
preames Aug 30, 2024
49b04e6
[gn build] Port 034f2b380bd2
llvmgnsyncbot Aug 30, 2024
5224f65
[gn build] Port 115b87636b9f
llvmgnsyncbot Aug 30, 2024
b4d9c52
[gn build] Port bd6531b95086
llvmgnsyncbot Aug 30, 2024
206b5af
AtomicExpand: Allow incrementally legalizing atomicrmw (#103371)
arsenm Aug 30, 2024
5703d85
[WebAssembly] Add intrinsics to wasm_simd128.h for all FP16 instructi…
brendandahl Aug 30, 2024
c55e24b
[llvm][LoongArch] Fix BSTRINS_D test failures on 32 bit hosts
DavidSpickett Aug 30, 2024
d58d105
[Analysis] isTriviallyVectorizable - add vectorization support for ac…
RKSimon Aug 30, 2024
68f0d20
Fix clang after ece6566048086cf2870d2c2bff46384df1b9e531
JoelWee Aug 30, 2024
a2615ad
[mlir] Align mlir::Block (#106717)
JoelWee Aug 30, 2024
9712255
Fix a minor issue with the documentation; NFC
AaronBallman Aug 30, 2024
1faa9c8
[Security] Nominate Matthew Voss to replace Paul Robinson on the Secu…
pogo59 Aug 30, 2024
348e741
[libc++][NFC] Run clang-format on libcxx/include
ldionne Aug 30, 2024
68805de
[IVDesc] Reuse getBinOpIdentity in getRecurrenceIdentity [nfc]
preames Aug 30, 2024
941feb7
[CostModel][X86] Fix SSE41/SSE42 cost checks on icmp tests
RKSimon Aug 30, 2024
18e5505
[mlir][polly][llvm-lit] Fixed logic for turning on external shell in …
connieyzhu Aug 30, 2024
f1cf091
[compiler-rt][test] Added `env` command to fix NSAN_OPTIONS command n…
Harini0924 Aug 30, 2024
f81f283
Revert "Reapply "[HWASan] remove incorrectly inferred attributes" (#1…
fmayer Aug 30, 2024
9764cf8
[llvm-lit] Add precommit test to verify current behavior of glob expa…
Harini0924 Aug 30, 2024
9a0030e
[ARM] Don't use -1 as invalid register number in assembly parser. (#1…
topperc Aug 30, 2024
688843b
[RISCV] Add constant folding combine for FMV_X_ANYEXTW/H. (#106653)
topperc Aug 30, 2024
c25293c
[LegalizeVectorOps][RISCV] Don't promote VP_FABS/FNEG/FCOPYSIGN. (#10…
topperc Aug 30, 2024
5b3ba43
Restructure createSimpleTargetReduction to match VP path [NFC]
preames Aug 30, 2024
9aa25b8
[LLDB][DWARF] Add an option to silence unsupported DW_FORM warnings (…
walter-erquinigo Aug 30, 2024
26f6091
[DirectX] Replace ResourceFlag enum with struct fields (#106617)
python3kgae Aug 30, 2024
4b553f4
Regen a bunch of vectorizer tests to avoid naming churn in upcoming r…
preames Aug 30, 2024
5af4ba2
Revert "[llvm-lit] Add precommit test to verify current behavior of g…
Harini0924 Aug 30, 2024
5500e21
Revert "[LLDB][DWARF] Add an option to silence unsupported DW_FORM wa…
walter-erquinigo Aug 30, 2024
a4aa6bc
[SLP]Fix PR106667: carefully look for operand nodes.
alexey-bataev Aug 30, 2024
6023d17
[SLP][NFC]Add a function description, NFC.
alexey-bataev Aug 30, 2024
ef7b18a
[X86] Rename trailing whitespace. NFC.
RKSimon Aug 30, 2024
d0d0e12
[AArch64] Fix a presumed typo in isFPImmLegal limit. NFC (#106716)
citymarina Aug 30, 2024
0efa386
[RISCV] Check VL dominates and potentially move in tryReduceVL (#106753)
lukel97 Aug 30, 2024
130eddf
[lldb] Deal with SupportFiles in SourceManager (NFC) (#106740)
JDevlieghere Aug 30, 2024
2c7e1b8
[SandboxIR] Implement ConstantFP (#106648)
vporpo Aug 30, 2024
0717898
Fix cl::desc typos in aarch64-enable-dead-defs and arm-implicit-it. (…
rjmansfield Aug 30, 2024
c49770c
[NFC] Prefer subprocess.DEVNULL over os.devnull (#106500)
nicovank Aug 30, 2024
079746d
[SLP]Better cost estimation for masked gather or "clustered" loads.
alexey-bataev Aug 30, 2024
8a267b7
[SLP][NFC]Remove unused variable
alexey-bataev Aug 30, 2024
688a274
[PtrUseVisitor] Allow using Argument as a starting point (#106308)
Artem-B Aug 30, 2024
6ab07d7
[SLP]Initial support for non-power-of-2 (but still whole register) nu…
alexey-bataev Aug 30, 2024
897b00f
Reuse getBinOpIdentity in createAnyOfTargetReduction [nfc]
preames Aug 30, 2024
5eda498
Revert "[mlir][Transforms] Dialect conversion: Make materializations …
matthias-springer Aug 30, 2024
c315d78
[VP] Reduce duplicate code in vp.reduce expansions
preames Aug 30, 2024
a3f8790
[libc++][NFC] Minor reformatting in <cstddef>
ldionne Aug 30, 2024
c53008d
[VPlan] Manually jumpthread a bit of reduction code for readability […
preames Aug 30, 2024
923a1c1
[WebAssembly] Update FP16 opcodes to match current spec. (#106759)
brendandahl Aug 30, 2024
5e7f0dc
[lldb] Include checksum in source cache dump (#106773)
JDevlieghere Aug 30, 2024
432e9f4
[llvm][LoongArch] Avoid shift overflow (#106785)
vitalybuka Aug 30, 2024
982d244
Revert "AtomicExpand: Allow incrementally legalizing atomicrmw" (#106…
vitalybuka Aug 30, 2024
57fe53c
[libc++] First attempt to regroup a few modules in the modulemap (#98…
ldionne Aug 30, 2024
06c531e
BPF: Generate locked insn for __sync_fetch_and_add() with cpu v1/v2 (…
yonghong-song Aug 30, 2024
d66765d
[gn build] Port 06c531e808ce
llvmgnsyncbot Aug 30, 2024
02654f7
[HLSL][Doc] Document multi-argument resolution (#104474)
llvm-beanz Aug 30, 2024
bf6bee8
[AutoBump] Merge with 02654f73 (Aug 30)
mgehre-amd Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 4 additions & 6 deletions clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,10 @@ async def main() -> None:
)
invocation.append("-list-checks")
invocation.append("-")
if args.quiet:
# Even with -quiet we still want to check if we can call clang-tidy.
with open(os.devnull, "w") as dev_null:
subprocess.check_call(invocation, stdout=dev_null)
else:
subprocess.check_call(invocation)
# Even with -quiet we still want to check if we can call clang-tidy.
subprocess.check_call(
invocation, stdout=subprocess.DEVNULL if args.quiet else None
)
except:
print("Unable to run clang-tidy.", file=sys.stderr)
sys.exit(1)
Expand Down
65 changes: 47 additions & 18 deletions clang-tools-extra/docs/clang-tidy/Contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ Writing a clang-tidy Check

So you have an idea of a useful check for :program:`clang-tidy`.

First, if you're not familiar with LLVM development, read through the `Getting
Started with LLVM`_ document for instructions on setting up your workflow and
First, if you're not familiar with LLVM development, read through the `Getting Started
with the LLVM System`_ document for instructions on setting up your workflow and
the `LLVM Coding Standards`_ document to familiarize yourself with the coding
style used in the project. For code reviews we mostly use `LLVM Phabricator`_.
style used in the project. For code reviews we currently use `LLVM Github`_,
though historically we used Phabricator.

.. _Getting Started with LLVM: https://llvm.org/docs/GettingStarted.html
.. _Getting Started with the LLVM System: https://llvm.org/docs/GettingStarted.html
.. _LLVM Coding Standards: https://llvm.org/docs/CodingStandards.html
.. _LLVM Phabricator: https://llvm.org/docs/Phabricator.html
.. _LLVM Github: https://github.com/llvm/llvm-project

Next, you need to decide which module the check belongs to. Modules
are located in subdirectories of `clang-tidy/
Expand Down Expand Up @@ -336,13 +337,25 @@ a starting point for your test cases. A rough outline of the process looks like
The quickest way to prototype your matcher is to use :program:`clang-query` to
interactively build up your matcher. For complicated matchers, build up a matching
expression incrementally and use :program:`clang-query`'s ``let`` command to save named
matching expressions to simplify your matcher. Just like breaking up a huge function
into smaller chunks with intention-revealing names can help you understand a complex
algorithm, breaking up a matcher into smaller matchers with intention-revealing names
can help you understand a complicated matcher. Once you have a working matcher, the
C++ API will be virtually identical to your interactively constructed matcher. You can
use local variables to preserve your intention-revealing names that you applied to
nested matchers.
matching expressions to simplify your matcher.

.. code-block:: console

clang-query> let c1 cxxRecordDecl()
clang-query> match c1

Alternatively, pressing the tab key after a previous matcher's open parentheses would also
show which matchers can be chained with the previous matcher, though some matchers that work
may not be listed.

Just like breaking up a huge function into smaller chunks with intention-revealing names
can help you understand a complex algorithm, breaking up a matcher into smaller matchers
with intention-revealing names can help you understand a complicated matcher.

Once you have a working clang-query matcher, the C++ API matchers will be the same or similar
to your interactively constructed matcher (there can be cases where they differ slightly).
You can use local variables to preserve your intention-revealing names that you applied
to nested matchers.

Creating private matchers
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -646,10 +659,13 @@ directory. The path to this directory is available in a lit test with the varia
Out-of-tree check plugins
-------------------------


Developing an out-of-tree check as a plugin largely follows the steps
outlined above. The plugin is a shared library whose code lives outside
outlined above, including creating a new module and doing the hacks to
register the module. The plugin is a shared library whose code lives outside
the clang-tidy build system. Build and link this shared library against
LLVM as done for other kinds of Clang plugins.
LLVM as done for other kinds of Clang plugins. If using CMake, use the keyword
``MODULE`` while invoking ``add_library`` or ``llvm_add_library``.

The plugin can be loaded by passing `-load` to `clang-tidy` in addition to the
names of the checks to enable.
Expand All @@ -664,6 +680,19 @@ compiled against the version of clang-tidy that will be loading the plugin.
The plugins can use threads, TLS, or any other facilities available to in-tree
code which is accessible from the external headers.

Note that testing out-of-tree checks might involve getting ``llvm-lit`` from an LLVM
installation compiled from source. See `Getting Started with the LLVM System`_ for ways
to do so.

Alternatively, get `lit`_ following the `test-suite guide`_ and get the `FileCheck`_ binary,
and write a version of `check_clang_tidy.py`_ to suit your needs.

.. _Getting Started with the LLVM System: https://llvm.org/docs/GettingStarted.html
.. _test-suite guide: https://llvm.org/docs/TestSuiteGuide.html
.. _lit: https://llvm.org/docs/CommandGuide/lit.html
.. _FileCheck: https://llvm.org/docs/CommandGuide/FileCheck.html
.. _check_clang_tidy.py: https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/test/clang-tidy/check_clang_tidy.py

Running clang-tidy on LLVM
--------------------------

Expand All @@ -688,10 +717,10 @@ warnings and errors. The script provides multiple configuration flags.

* To restrict the files examined you can provide one or more regex arguments
that the file names are matched against.
``run-clang-tidy.py clang-tidy/.*Check\.cpp`` will only analyze clang-tidy
``run-clang-tidy.py clang-tidy/.*Check\.cpp`` will only analyze `clang-tidy`
checks. It may also be necessary to restrict the header files that warnings
are displayed from using the ``-header-filter`` flag. It has the same behavior
as the corresponding :program:`clang-tidy` flag.
are displayed from by using the ``-header-filter`` and ``-exclude-header-filter`` flags.
They have the same behavior as the corresponding :program:`clang-tidy` flags.

* To apply suggested fixes ``-fix`` can be passed as an argument. This gathers
all changes in a temporary directory and applies them. Passing ``-format``
Expand Down Expand Up @@ -758,4 +787,4 @@ There is only one argument that controls profile storage:

* If you run :program:`clang-tidy` from within ``/foo`` directory, and specify
``-store-check-profile=.``, then the profile will still be saved to
``/foo/<ISO8601-like timestamp>-example.cpp.json``
``/foo/<ISO8601-like timestamp>-example.cpp.json``
121 changes: 109 additions & 12 deletions clang/docs/HLSL/ExpectedDifferences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ HLSL 202x based on proposal
and
`0008 <https://github.com/microsoft/hlsl-specs/blob/main/proposals/0008-non-member-operator-overloading.md>`_.

The largest difference between Clang and DXC's overload resolution is the
algorithm used for identifying best-match overloads. There are more details
about the algorithmic differences in the :ref:`multi_argument_overloads` section
below. There are three high level differences that should be highlighted:

* **There should be no cases** where DXC and Clang both successfully
resolve an overload where the resolved overload is different between the two.
* There are cases where Clang will successfully resolve an overload that DXC
wouldn't because we've trimmed the overload set in Clang to remove ambiguity.
* There are cases where DXC will successfully resolve an overload that Clang
will not for two reasons: (1) DXC only generates partial overload sets for
builtin functions and (2) DXC resolves cases that probably should be ambiguous.

Clang's implementation extends standard overload resolution rules to HLSL
library functionality. This causes subtle changes in overload resolution
behavior between Clang and DXC. Some examples include:
Expand All @@ -71,18 +84,23 @@ behavior between Clang and DXC. Some examples include:
uint U;
int I;
float X, Y, Z;
double3 A, B;
double3 R, G;
}

void twoParams(int, int);
void twoParams(float, float);
void takesSingleDouble(double);
void takesSingleDouble(vector<double, 1>);

void scalarOrVector(double);
void scalarOrVector(vector<double, 2>);

export void call() {
halfOrInt16(U); // DXC: Fails with call ambiguous between int16_t and uint16_t overloads
// Clang: Resolves to halfOrInt16(uint16_t).
halfOrInt16(I); // All: Resolves to halfOrInt16(int16_t).
half H;
halfOrInt16(I); // All: Resolves to halfOrInt16(int16_t).

#ifndef IGNORE_ERRORS
halfOrInt16(U); // All: Fails with call ambiguous between int16_t and uint16_t
// overloads

// asfloat16 is a builtin with overloads for half, int16_t, and uint16_t.
H = asfloat16(I); // DXC: Fails to resolve overload for int.
// Clang: Resolves to asfloat16(int16_t).
Expand All @@ -94,21 +112,28 @@ behavior between Clang and DXC. Some examples include:

takesDoubles(X, Y, Z); // Works on all compilers
#ifndef IGNORE_ERRORS
fma(X, Y, Z); // DXC: Fails to resolve no known conversion from float to double.
fma(X, Y, Z); // DXC: Fails to resolve no known conversion from float to
// double.
// Clang: Resolves to fma(double,double,double).
#endif

double D = dot(A, B); // DXC: Resolves to dot(double3, double3), fails DXIL Validation.
double D = dot(R, G); // DXC: Resolves to dot(double3, double3), fails DXIL Validation.
// FXC: Expands to compute double dot product with fmul/fadd
// Clang: Resolves to dot(float3, float3), emits conversion warnings.
// Clang: Fails to resolve as ambiguous against
// dot(half, half) or dot(float, float)
#endif

#ifndef IGNORE_ERRORS
tan(B); // DXC: resolves to tan(float).
// Clang: Fails to resolve, ambiguous between integer types.

twoParams(I, X); // DXC: resolves twoParams(int, int).
// Clang: Fails to resolve ambiguous conversions.
#endif

double D;
takesSingleDouble(D); // All: Fails to resolve ambiguous conversions.
takesSingleDouble(R); // All: Fails to resolve ambiguous conversions.

scalarOrVector(D); // All: Resolves to scalarOrVector(double).
scalarOrVector(R); // All: Fails to resolve ambiguous conversions.
}

.. note::
Expand All @@ -119,3 +144,75 @@ behavior between Clang and DXC. Some examples include:
diagnostic notifying the user of the conversion rather than silently altering
precision relative to the other overloads (as FXC does) or generating code
that will fail validation (as DXC does).

.. _multi_argument_overloads:

Multi-Argument Overloads
------------------------

In addition to the differences in single-element conversions, Clang and DXC
differ dramatically in multi-argument overload resolution. C++ multi-argument
overload resolution behavior (or something very similar) is required to
implement
`non-member operator overloading <https://github.com/microsoft/hlsl-specs/blob/main/proposals/0008-non-member-operator-overloading.md>`_.

Clang adopts the C++ inspired language from the
`draft HLSL specification <https://microsoft.github.io/hlsl-specs/specs/hlsl.pdf>`_,
where an overload ``f1`` is a better candidate than ``f2`` if for all arguments the
conversion sequences is not worse than the corresponding conversion sequence and
for at least one argument it is better.

.. code-block:: c++

cbuffer CB {
int I;
float X;
float4 V;
}

void twoParams(int, int);
void twoParams(float, float);
void threeParams(float, float, float);
void threeParams(float4, float4, float4);

export void call() {
twoParams(I, X); // DXC: resolves twoParams(int, int).
// Clang: Fails to resolve ambiguous conversions.

threeParams(X, V, V); // DXC: resolves threeParams(float4, float4, float4).
// Clang: Fails to resolve ambiguous conversions.
}

For the examples above since ``twoParams`` called with mixed parameters produces
implicit conversion sequences that are { ExactMatch, FloatingIntegral } and {
FloatingIntegral, ExactMatch }. In both cases an argument has a worse conversion
in the other sequence, so the overload is ambiguous.

In the ``threeParams`` example the sequences are { ExactMatch, VectorTruncation,
VectorTruncation } or { VectorSplat, ExactMatch, ExactMatch }, again in both
cases at least one parameter has a worse conversion in the other sequence, so
the overload is ambiguous.

.. note::

The behavior of DXC documented below is undocumented so this is gleaned from
observation and a bit of reading the source.

DXC's approach for determining the best overload produces an integer score value
for each implicit conversion sequence for each argument expression. Scores for
casts are based on a bitmask construction that is complicated to reverse
engineer. It seems that:

* Exact match is 0
* Dimension increase is 1
* Promotion is 2
* Integral -> Float conversion is 4
* Float -> Integral conversion is 8
* Cast is 16

The masks are or'd against each other to produce a score for the cast.

The scores of each conversion sequence are then summed to generate a score for
the overload candidate. The overload candidate with the lowest score is the best
candidate. If more than one overload are matched for the lowest score the call
is ambiguous.
6 changes: 2 additions & 4 deletions clang/docs/tools/generate_formatted_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def get_style(count, passed):
- {style2}`{percent}%`
"""

FNULL = open(os.devnull, "w")


with open(DOC_FILE, "wb") as output:
cleanfiles = open(CLEAN_FILE, "wb")
Expand All @@ -101,8 +99,8 @@ def get_style(count, passed):
# interested in it, just the return code.
git_check = subprocess.Popen(
["git", "ls-files", "--error-unmatch", act_sub_dir],
stdout=FNULL,
stderr=FNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
if git_check.wait() != 0:
print("Skipping directory: ", act_sub_dir)
Expand Down
9 changes: 9 additions & 0 deletions clang/include/clang/Basic/BuiltinsWebAssembly.def
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ TARGET_BUILTIN(__builtin_wasm_bitmask_i16x8, "UiV8s", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_bitmask_i32x4, "UiV4i", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_bitmask_i64x2, "UiV2LLi", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_abs_f16x8, "V8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_abs_f32x4, "V4fV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_abs_f64x2, "V2dV2d", "nc", "simd128")

Expand All @@ -140,6 +141,10 @@ TARGET_BUILTIN(__builtin_wasm_max_f16x8, "V8hV8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_pmin_f16x8, "V8hV8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_pmax_f16x8, "V8hV8hV8h", "nc", "fp16")

TARGET_BUILTIN(__builtin_wasm_ceil_f16x8, "V8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_floor_f16x8, "V8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_trunc_f16x8, "V8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_nearest_f16x8, "V8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_ceil_f32x4, "V4fV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_floor_f32x4, "V4fV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_trunc_f32x4, "V4fV4f", "nc", "simd128")
Expand All @@ -151,9 +156,13 @@ TARGET_BUILTIN(__builtin_wasm_nearest_f64x2, "V2dV2d", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_dot_s_i32x4_i16x8, "V4iV8sV8s", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_sqrt_f16x8, "V8hV8h", "nc", "fp16")
TARGET_BUILTIN(__builtin_wasm_sqrt_f32x4, "V4fV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_sqrt_f64x2, "V2dV2d", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i16x8_f16x8, "V8sV8h", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i16x8_f16x8, "V8sV8h", "nc", "simd128")

TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32x4_f32x4, "V4iV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32x4_f32x4, "V4iV4f", "nc", "simd128")

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5324,11 +5324,11 @@ bool Compiler<Emitter>::VisitVectorUnaryOperator(const UnaryOperator *E) {

auto UnaryOp = E->getOpcode();
if (UnaryOp != UO_Plus && UnaryOp != UO_Minus && UnaryOp != UO_LNot &&
UnaryOp != UO_Not)
UnaryOp != UO_Not && UnaryOp != UO_AddrOf)
return this->emitInvalid(E);

// Nothing to do here.
if (UnaryOp == UO_Plus)
if (UnaryOp == UO_Plus || UnaryOp == UO_AddrOf)
return this->delegate(SubExpr);

if (!Initializing) {
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Basic/SourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ void SourceManager::clearIDTables() {
LastLineNoContentCache = nullptr;
LastFileIDLookup = FileID();

IncludedLocMap.clear();
if (LineTable)
LineTable->clear();

Expand Down
Loading