Skip to content

[Clang] Fix crash in CheckNonTypeTemplateParameterType with invalid type#2

Open
sdkrystian wants to merge 6192 commits intocppalliance:mainfrom
sdkrystian:fix-177545
Open

[Clang] Fix crash in CheckNonTypeTemplateParameterType with invalid type#2
sdkrystian wants to merge 6192 commits intocppalliance:mainfrom
sdkrystian:fix-177545

Conversation

@sdkrystian
Copy link
Member

@sdkrystian sdkrystian commented Jan 26, 2026

When a non-type template parameter has a type containing an undeduced placeholder type that is invalid (e.g., a function returning a function), SubstAutoTypeSourceInfoDependent can return null if the type is invalid. CheckNonTypeTemplateParameterType was not handling this case and would dereference the null pointer.

Fixes llvm#177545

Copy link

@shafik shafik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but this need a release note.

GkvJwa and others added 28 commits March 12, 2026 10:53
Fix llvm#180648 caused by an unhandled `Argument` for parameters exceeding
ABI size limits. This patch explicitly emits an `alloca` for the `Argument` in 
the entry block to ensure correct address resolution.
This PR adds AMDGPUTargetCIRGenInfo and AMDGPUABIInfo to handle the
amdgcn triple in CIR code generation, along with a
basic HIP codegen test.
Remove `NoSignedZerosFPMath` uses, one of flags in `resetTargetOptions`,
users should use `nsz` instead.
…lvm#184988)

This change marks the test
`modules-symlink-dir-from-module-incremental.c` as "unsupported" on AIX.
The test relies on the -F flag to specify framework search paths, which
is a driver feature exclusive to Darwin, and it is not supported on the
AIX target.

Co-authored-by: Aditya Chaudhary <aditya.chaudhary1@ibm.com>
…lvm#186015)

Fix unresolved external functions: _Z15__clc_get_fencePv,
_Z15__clc_to_globalPv, _Z14__clc_to_localPv, _Z16__clc_to_privatePv
… indexed segment load (llvm#184963)

llvm@f7ca74f
has added basic check for register overlap.
Furthermore, we need to add extra check for register group overlap since
more registers will be occupied in segment load.
This avoids bithacking on the values and improves value
tracking.
This was originally ported from rocm device libs in
d6d0454. Update for
more recent changes that were made there. This avoids
bithacking and improves value tracking. This also allows
using a common code path for all types.
Similar to the previous logb change, use a common
bithacking free implementation.
When >1 predecessors of BB are identical, try to merge them into ONE.


---

Here is a simplified example (`sink` and `bb*`s share the same
predecessor `entry`, hindering the existing uncond br folding to
optimize such a case):
```diff
- entry:
-   switch to %br1, %br2, %br3, %sink
- bb1:
-   br label %sink
- bb2:
-   br label %sink
- bb3:
-   br label %sink
- sink:
-   %ret = phi i8 [ 0, %bb1 ], [ 0, %bb2 ], [ 0, %bb3 ], [ -1, %entry ]
+ entry:
+   switch to %br1, %sink
+ bb1:
+   br label %sink
+ sink:
+   %ret = phi i8 [ 0, %bb1 ], [ -1, %entry ]
```

Actually, `simplifyDuplicateSwitchArms` did similar things in a very
limited scope (only for switch arms), this patch generalizes its logic
to handle any BB with >1 identical predecessors.

---


This PR lands the
[discussion](dtcxzyw/llvm-opt-benchmark#3033 (comment)),
i.e., "merge identical predecessor bottom to up", and implements the
suggestion of
llvm#114262 (comment).

- IR diff: dtcxzyw/llvm-opt-benchmark#3537
- CompTime Impact:
dtcxzyw/llvm-opt-benchmark#3538
…(NFC)" (llvm#185410)

Relocate HTTPClient and HTTPServer from the Debuginfod library to
llvm/Support/HTTP so they can be reused by other components.

---------

Relanding with fixes in CMakeLists.txt to account for dependency to new
LLVMSupportHTTP in tools.

---------

Co-authored-by: Alexandre Ganea <aganea@havenstudios.com>
Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
…m#186044)

Similar to commit 557efc9 (2022).

cl::ZeroOrMore is the default for cl::list and is unnecessary for
cl::opt
since the "may only occur zero or one times!" error was removed.
Also remove cl::init(false) on modified cl::opt<bool> lines.
Add a config to document building compiler-rt for a baremetal RISCV
target. It works on a Linux host, but not a macOS host, due to CMake
issues.

Documenting building libcxx and libcxxabi for these targets is left to a
follow-up.
…TTP lib (NFC)"" (llvm#186051)

Reverts llvm#185410

Looks like I have to check polly a well
The recursion here has potentially exponential complexity. Avoid this by
limiting the depth of recursion.

An alternative would be to memoize the results. I went with the simpler
depth limit on the assumption that we don't particularly care about very
deep value chains here.

Fixes llvm#185905.
…ause (llvm#152831)

Part 3 adding offload runtime support. See
llvm#152651.

---------

Co-authored-by: Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>
Similar to what we already do for SHL(1, Amt) - just insert the (locally
shifted) bit into a zero vector in the correct element

After this I just need to handle SRA(SIGN_BIT, Amt) and SHL/SRL(-1, Amt)
mask creation patterns and I think that's it for llvm#132601
VertexID semantic only allows uint as type. Looking at DXC, it seems the
uint16 variant is allowed, but that's not documented. Until we figure
out the real behavior, we restrict the type to only uint.
Looking back in the history as far as edb874b, there was a
sentence here to say we don't have an equivalent.

Put that sentence back, and make the first line a header as it was in
that HTML version.
Add utility for compensated arithmetic, which should be used
by a number of the large functions.
The log implementation was originally ported from
rocm device libs way back in 44b6117.
Update this to a version derived from the latest. Leaves the float and
half cases alone.
This reverts commit 0779914.

Need to revert this follow up commit to 6758bec
in order to revert an earlier commit which caused 2 test failures on a bot.
…jc_msgSend. (llvm#183922)"

This reverts commit 6758bec.

This change was causing 2 test failures on a build bot https://lab.llvm.org/buildbot/#/builders/190/builds/38293.
In llvm#124103 we changed the size of various iostream objects, which turns
out to be ABI breaking when compiling non-PIE code.

This ABI break is safe to fix, since for any programs allocating more
memory for the iostream objects, the remaining bytes are simply unused
now.

Fixes llvm#185724
…ssible (llvm#179178)

See

https://clang.llvm.org/docs/StandardCPlusPlusModules.html#experimental-non-cascading-changes
for the full background.

In short, we want to cut off the dependencies to improve the
recompilation time.

And namespace is special, as the same namespace can occur in many TUs.

This patch tries to clean up unneeded reference to namespace from other
module file. The touched parts are:

- When write on disk lookup table, don't write the merged table. This
makes the ownership/dependency much cleaner. For performance, I think
the intention was to make the cost of mergin table amortized. But in our
internal workloads, I didn't observe any regression if I turn off
writing the merged table.
- When writing redeclarations, only write the ID of the first namespace
and avoid referenece to all other previous namespaces. (I don't want to
write the first namespace either... but it is more complex).
- When writing the name lookup table, try to write the local namespace.

@jtstogel @mpark I want to invite you to test this with your internal
workloads to figure out the correctness and the performance impact on
this.

I know I can make the change clean for you by inserting code guarded by
"if writing named module" but I think it will be much better if we can
make the underlying implementation more homogeneous if possible.
jayfoad and others added 13 commits March 13, 2026 11:46
…cAnalysisFramework/ (llvm#186156)

- Rename `clang/{include,lib,unittests}/Analysis/Scalable/` to
`clang/{include,lib,unittests}/ScalableStaticAnalysisFramework/Core/`
- Update header-guards with their new paths
- Rename the library `clangAnalysisScalable` to
`clangScalableStaticAnalysisFrameworkCore`
- Add a new `Clang_ScalableStaticAnalysisFramework` module to
`module.modulemap`
- Update GN build files, GitHub PR labeler, and documentation
- Harmonise license comments
- Add a missing header-guard
…nt code (llvm#185532)

Change the 'CmpInfo' tuple to a struct and rename adjustCmp() to
getAdjustedCmpInfo()
…llvm#182200)

Always allow multiple uses of normal loads in mayFoldIntoVector - scalarisation should break the vector load apart again if we fail to use a vector op.

Closes llvm#164632
…sin cos intrinsics. (llvm#185934)

This patch adds register bank legalization rules for amdgcn sin and cos
operations in the AMDGPU GlobalISel pipeline.
…86376)

We don't need ElemLoc unless we have an element ctor func.
This patch is a prelude to
llvm#174635. It implements a
Windows version of the `FifoFile` class used in lldb-dap.

This change is not used as is, it will be used when
llvm#174635 lands.
joker-eph and others added 15 commits March 13, 2026 14:17
…llvm#186270)

The `ExtractFromShapeOfExtentTensor` canonicalization pattern was
unconditionally rewriting:

  tensor.extract(shape.shape_of(%arg), %idx) -> tensor.dim(%arg, %idx)

even when `%arg` is a memref. This produced an invalid `tensor.dim`
(whose source operand must be a tensor), which then caused an assertion
failure in `DimOp::getSource()` when subsequent canonicalization
patterns tried to match the op:

Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type\!"'
  failed.  [To = TypedValue<TensorType>, From = Value]

Fix: add an `IsTensorType` constraint to
`ExtractFromShapeOfExtentTensor` in `ShapeCanonicalization.td` so the
pattern only fires when `%arg` is a tensor type. The memref case is
intentionally left unfolded (the correct lowering to `memref.dim` would
require adding a MemRef dependency to the Shape dialect, which is not
desirable).

Tests cover both the positive case (tensor arg folds to tensor.dim) and
the negative case (memref arg is left unmodified).

Fixes llvm#185248

Assisted-by: Claude Code
…lback fallthrough (llvm#186150)

When parseCustomEntry() calls a user attribute/type callback that
internally reads sub-attributes/types via the bytecode reader, the
reader may add entries to the deferredWorklist if the depth limit is
exceeded. If the callback then returns success with an empty entry
(falling through to the regular dialect reader), the reader position is
reset but deferredWorklist retains stale entries from the failed partial
read.

This causes an assert(deferredWorklist.empty()) failure in debug builds
when the fallback dialect reader successfully parses the attribute.

Fix by saving and restoring deferredWorklist.size() around each callback
invocation, discarding any stale entries added during a callback's
partial read when the reader position is rolled back.

Fixes llvm#163337

Assisted-by: Claude Code
…6369)

Pass MF into the SIInsertWaitcnts constructor instead of the run method.
This is more natural now that SIInsertWaitcnts is constructed once per
MachineFunction and enables future cleanup by initializing more fields
in the constructor that depend on MF.
…shuffle result (llvm#185713)

In foldShuffleOfSelects, if the shuffle result has a single element, the
resulting type may be scalar rather than a vector. The later code in
foldShuffleOfSelects assumes the result is a vector and performs cast<
FixedVectorType >, which triggers an assertion.

Fixes llvm#183625
This showed up in a test suite. A zero-initializer for a whole struct
seems completely sensible, as long as the type is zero-initializable.

This patch doesn't change the non-zero-init behavior (I am working on a
patch to do so, but it is a massive scope), so this is limited to JUST
classes with bases.
)

This commit updates profile compliance to allow integer gather and
scatter operations to be used with the floating point profile. This
update aligns with the specification change:
arm/tosa-specification#35.
Largely straight-forward replacement.
…ntative (llvm#183036)

Currently the query benchmarks are training the branch predictor
incredibly well, which isn't representative of the real world. This
change causes the branch misses to go from <1% to ~50% with the current
implementation of `__tree::__find_end`.

This patch also removes the `non-existent` benchmarks, since it'd be
non-trivial to write a representative benchmark for that case, and the
benchmark would be relatively low value. We're already searching to leaf
nodes ~50% of the time (since half the nodes are leaves) with the
current benchmark. So we'd only additionally cover a relatively trivial
failure branch that is only taken once per function call. The loop is
already covered through benchmarking with keys existing in the
container.
Support parsing and printing inline assembly operands in MIR using the
symbolic form instead of numeric register class IDs, thus removing the
need to update tests when the numbers change.

The numeric form remains supported.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…inedNodes list (llvm#186225)

DwarfFile asserts if two arguments of the same subprogram with the same
index are present in a DISubprogram scope:
https://github.com/llvm/llvm-project/blob/5d7a502a9d923784abe4382ec479ee1c0667d743/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp#L110

This patch adds a check to the Verifier to detect such invalid IR
earlier. It can be helpful for finding reproducers for bugs like
https://issues.chromium.org/issues/40288032.

The incorrect args field of DILocalVariable in
llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir is fixed.
SubstAutoTypeSourceInfoDependent can return null when transforming an
invalid type containing decltype(auto). Handle this case by returning
QualType() to signal failure.

Fixes llvm#177545
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.