Commit Graph

543142 Commits

Author SHA1 Message Date
Razvan Lupusoru
f16983f7d0 [flang][acc] Ensure fir.class is handled in type categorization (#146174)
fir.class is treated similarly as fir.box - but it has one key
distinction which is that it doesn't hold an element type. Thus the
categorization logic was mishandling this case for this reason (and also
the fact that it assumed that a base object is always a fir.ref).

This PR improves this handling and adds appropriate test exercising both
a class and a class field to ensure categorization works.
2025-06-30 15:04:14 -07:00
realqhc
6896d8a05d [RISCV][MC] Support Base P non-GPR pair instructions (#137927) 2025-07-01 08:01:06 +10:00
Florian Hahn
59a7185dd9 [VPlan] Truncate/Extend ComputeReductionResult at construction (NFC). (#141860)
Instead of looking up the narrower reduction type via getRecurrenceType
we can generate the needed extend directly at constructiond re-use the
truncated value from the loop.

PR: https://github.com/llvm/llvm-project/pull/141860
2025-06-30 22:39:17 +01:00
Jeffrey Byrnes
d599bdeaa4 [AMDGPU] Autogen checks for test (#146421)
Needed for upcoming PR for RA priorities
2025-06-30 14:36:23 -07:00
Jonas Devlieghere
1eb795413d [lldb] Correctly restore the cursor column after resizing the statusline (#146132)
This PR ensures we correctly restore the cursor column after resizing
the statusline. To ensure we have space for the statusline, we have to
emit a newline to move up everything on screen. The newline causes the
cursor to move to the start of the next line, which needs to be undone.

Normally, we would use escape codes to save & restore the cursor
position, but that doesn't work here, as the cursor position may have
(purposely) changed. Instead, we move the cursor up one line using an
escape code, but we weren't restoring the column.

Interestingly, Editline was able to recover from this issue through the
LineInfo struct which contains the buffer and the cursor location, which
allows us to compute the column. This PR addresses the bug by having
Editline "refresh" the cursor position.

Fixes #134064
2025-06-30 14:34:35 -07:00
Ellis Hoag
0d1392e979 [MachineOutliner] Remove LOHs from outlined candidates (#143617)
Remove Linker Optimization Hints (LOHs) from outlining candidates
instead of simply preventing outlining if LOH labels are found in the
candidate. This will improve the effectiveness of the machine outliner
when LOHs are enabled (which is the default).

In
https://discourse.llvm.org/t/loh-conflicting-with-machineoutliner/83279/1
it was observed that the machine outliner is much more effective when
LOHs are disabled. Rather than completely disabling LOH, this PR aims to
keep LOH in most places and removing them from outlined functions where
it could be illegal. Note that we are conservatively removing all LOHs
from outlined functions for simplicity, but I believe we could retain
LOHs that are in the intersection of all candidates.

It should be ok to remove these LOHs since these blocks are being
outlined anyway, which will harm performance much more than the gain
from keeping the LOHs.
2025-06-30 14:29:06 -07:00
Valentin Clement (バレンタイン クレメン)
f4cecfe1bb [flang][cuda] Bring PARAMETER arrays into the GPU module (#146416) 2025-06-30 14:24:44 -07:00
Kazu Hirata
56739f5866 [Analysis] Fix a warning
This patch fixes:

  llvm/lib/Analysis/IR2Vec.cpp:296:2: error: extra ';' outside of a
  function is incompatible with C++98
  [-Werror,-Wc++98-compat-extra-semi]
2025-06-30 14:18:03 -07:00
S. VenkataKeerthy
0745eb501d [IR2Vec] Scale embeddings once in vocab analysis instead of repetitive scaling (#143986)
Changes to scale opcodes, types and args once in `IR2VecVocabAnalysis` so that we can avoid scaling each time while computing embeddings. This PR refactors the vocabulary to explicitly define 3 sections---Opcodes, Types, and Arguments---used for computing Embeddings. 

(Tracking issue - #141817 ; partly fixes - #141832)
2025-06-30 23:09:19 +02:00
Mahesh-Attarde
56ef00a59d [X86][GlobalISel] Fix RegBank issue for G_FABS (#145674)
Fixes hidden issue in https://github.com/llvm/llvm-project/pull/136718. 
It removes custom selection code since problem was in RegBank
assignment
2025-06-30 22:52:12 +02:00
Jonas Devlieghere
eb904e857a [lldb] Fix link syntax in docs/use/mcp.md 2025-06-30 13:50:32 -07:00
S. VenkataKeerthy
dcf8ec9218 Reland "[MLGO][IR2Vec] Integrating IR2Vec with MLInliner (#143479)" (#145664)
Relanding #143479 after fixes. 

Removed `NumberOfFeatures` from the `FeatureIndex` enum as the number of features used depends on whether IR2Vec embeddings are used.
2025-06-30 22:37:39 +02:00
Florian Hahn
026aae7047 [VPlan] Infer reduction result types w/o accessing underlying phis.(NFC)
Remove another use of the underlying IR phi.
2025-06-30 21:29:29 +01:00
Amr Hesham
f205e354ae [CIR] Upstream GenericSelectionExpr for ComplexType (#146265)
Upstream the GenericSelectionExpr for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-06-30 22:25:01 +02:00
sribee8
81c9a1a4e5 [libc][obvious] Fixed typos in some wchar headers (#146413)
Some of the wchar headers had typos in them.

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-30 20:22:05 +00:00
Krzysztof Parzyszek
4c7d3e9315 [STLForwardCompat] Implement llvm::type_identity (#146390)
A basic implementation until we get it in `std` in C++20.
2025-06-30 15:05:49 -05:00
sribee8
4bf0c6b5f8 [libc][bazel] Added wchar functions to bazel (#146126)
Added wchar functions, apart from ones that use mbstate_t. to the bazel
files

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-30 20:05:26 +00:00
Robert Konicar
163a7e1b4f [mlir][LLVMIR][NFC] Remove duplicate getUnnamedAddrAttrName uses in op printers (#146090)
Fix `UnnamedAddrAttrName` being inserted twice into the `elidedAttrs`
list for the attribute dictionary printer in `GlobalOp` and `AliasOp`
print functions.
2025-06-30 21:57:05 +02:00
Eugene Epshteyn
93849a39c4 [flang] Check for ultimate ALLOCATABLE component in LOCAL_INIT() (#145800)
Fortran 2023 constraint C1130 disallows variables of derived type with
ultimate allocatable component to appear in LOCAL_INIT().
2025-06-30 15:49:07 -04:00
Erick Velez
a68e4470c1 [clang-doc] serialize friends (#146165)
Parse friends into a new FriendInfo and serialize them in JSON. We keep track of the friend declaration's template and function information if applicable.
2025-06-30 12:43:52 -07:00
Baranov Victor
96b9b2e21d [Clang] Fix '-Wformat-overflow' FP when floats had field-width and plus prefix (#144274)
If field width is specified, the sign/space is already accounted for
within the field width, so no additional size is needed.

Fixes https://github.com/llvm/llvm-project/issues/143951.

---------

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2025-06-30 22:43:47 +03:00
Slava Zakharin
90da61634a [flang] Use outermost fir.dummy_scope for TBAA of local allocations. (#146006)
This change only matters when MLIR function inlining kicks in,
and I am still just experimenting with this.

The added LIT test shows the particular example where the current
TBAA assignment is incorrect:
```
  subroutine bar(this)
    ...
  end subroutine bar
  function foo() result(res)
    type(t) :: res
    call bar(res)
  end function foo
  subroutine test(arg)
    ! %0 = fir.alloca !fir.type<_QMmTt{x:f32}> {bindc_name = ".result"}
    type(t) :: var
    var = foo()
    ! fir.save_result foo's result to %0 (temp-alloca)
    ! fir.declare %0 {uniq_name = ".tmp.func_result"}
    ! load from %0 -> store into var
    arg = var%x
  end subroutine test
```

One way for FIR inlining to handle `foo()` call is to substitute
all uses of the `res` alloca (inside `foo`) with uses of the temp-alloca
(inside `test`). This means that the temp-alloca is then used
by the code inside bar (e.g. to store something into it).
After the inlining, the innermost dominating fir.dummy_scope
for `fir.declare %0` is the one from `bar`. If we use this scope
for assigning TBAA to the load from temp-alloca, then it will be
in the same TBAA tree as the stores into `this` inside `bar`.
The load and the stores will have different sub-trees, because
`this` is a dummy argument, and temp-alloca is a local allocation.
So they will appear as non-conflicting while they are accessing
the same memory.

This change makes sure that all local allocations always
use the outermost scope.
2025-06-30 12:37:30 -07:00
Dimitrije Dobrota
0f291e5787 [clang-tidy] Add flag to specify an alternative to std::move in cppcoreguidelines-rvalue-reference-param-not-moved (#138757)
Since std::move is nothing more than a cast, part of STL and not the
language itself, it's easy to provide a custom implementation if one
wishes not to include the entirety of <utility>.

Added flag (MoveFunction) provides a way to continue using this
essential check even with the custom implementation of moving.

---------

Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
2025-06-30 22:36:23 +03:00
Mehdi Amini
5f91b697bc [MLIR] Always emit setPropertiesFromParsedAttr() when hasCustomAssemblyFormat is set (#145973)
This allows people writing custom C++ assembly functions to reuse the
"prop-dict" parser.

Fix #145028
2025-06-30 21:35:16 +02:00
Mircea Trofin
46628718c0 [IR][PGO] Verify the structure of VP metadata. (#145584) 2025-06-30 12:31:19 -07:00
Fabian Mora
878d3594ed [mlir][vector] Avoid setting padding by default to 0 in vector.transfer_read prefer ub.poison (#146088)
Context:
`vector.transfer_read` always requires a padding value. Most of its
builders take no `padding` value and assume the safe value of `0`.
However, this should be a conscious choice by the API user, as it makes
it easy to introduce bugs.
For example, I found several occasions while making this patch that the
padding value was not getting propagated (`vector.transfer_read` was
transformed into another `vector.transfer_read`). These bugs, were
always caused because of constructors that don't require specifying
padding.

Additionally, using `ub.poison` as a possible default value is better,
as it indicates the user "doesn't care" about the actual padding value,
forcing users to specify the actual padding semantics they want.

With that in mind, this patch changes the builders in
`vector.transfer_read` to always having a `std::optional<Value> padding`
argument. This argument is never optional, but for convenience users can
pass `std::nullopt`, padding the transfer read with `ub.poison`.

---------

Signed-off-by: Fabian Mora <fabian.mora-cordero@amd.com>
2025-06-30 15:20:42 -04:00
Dimitrije Dobrota
6a57af8d03 [clang-tidy] Add flag to specify an alternative to std::forward (#138755)
Since std::forward is nothing more than a cast, part of STL and not the
language itself, it's easy to provide a custom implementation if one
wishes not to include the entirety of <utility>.

Added flag (ForwardFunction) provides a way to continue using this
essential check even with the custom implementation of forwarding.

---------

Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
2025-06-30 22:13:33 +03:00
Erick Velez
ba84d0c8d7 [clang-doc] Precommit friends test (#146164) 2025-06-30 11:47:09 -07:00
Vitaly Buka
233078fd8d [nfc][asan] clang-format for #145087 2025-06-30 11:34:04 -07:00
Ye Luo
536ba87726 [libomptarget] Add a test for OMP_TARGET_OFFLOAD=disabled (#146385)
closes https://github.com/llvm/llvm-project/issues/144786
2025-06-30 13:29:36 -05:00
Vy Nguyen
5548f4d5ef [LLDB][NFC] Refactor code extracting timestamp from StructuredData (#145954)
Co-authored-by: Alex Langford <nirvashtzero@gmail.com>
2025-06-30 14:25:11 -04:00
Erich Keane
125dbe103e [OpenACC][CIR] 'update' construct lowering + a few clauses (#146378)
The 'update' construct has 3 'var-list' clauses, device, self, and host.
Each has a pretty simple data-operand type syntax in the IR, so this
patch implements them as well. At least one of those is required to be
present on an 'update', so we cannot do any lowering without them.

Note that 'self' and 'host' are aliases.
2025-06-30 11:24:17 -07:00
Peter Klausler
2d825cc3af [flang] Add new hints to expected warnings (#146399)
I added a new test with warnings, but warnings are now emitted with
hints. Add them to the new test.
2025-06-30 11:19:05 -07:00
Justin King
b2b20eeb54 tsan: Support free_sized and free_aligned_sized from C23 (#144531)
Adds support to TSan for `free_sized` and `free_aligned_sized` from C23.

Other sanitizers will be handled with their own separate PRs.

For https://github.com/llvm/llvm-project/issues/144435

Signed-off-by: Justin King <jcking@google.com>
2025-06-30 11:09:46 -07:00
Eric Fiselier
01d0171e7a Address formatting mistake in libc++ test 2025-06-30 13:53:24 -04:00
Timm Baeder
36cf51d16e [clang][bytecode] Classify variable initializer, not the decl (#146338)
I'm not attaching a test case because I wasn't able to reproduce. The
backtrace looks as follows:

```
    frame #10: 0x00007fffdedf0b0d libclang-cpp.so.21.0git`clang::interp::Context::evaluateAsInitializer(this=0x00007c6f839f62f0, Parent=0x00007bff7f3820e0, VD=0x00007bff77ce24b0, Result=0x00007bff7165cd78) at Context.cpp:123:16
    frame #11: 0x00007fffde7bcc2f libclang-cpp.so.21.0git`clang::Expr::EvaluateAsInitializer(this=0x00007bff77ce3078, Value=0x00007bff7165cd78, Ctx=0x00007e9f839f8200, VD=0x00007bff77ce24b0, Notes=0x00007bff7f0d1620, IsConstantInitialization=false) const at ExprConstant.cpp:17096:20
    frame #12: 0x00007fffdde7ca84 libclang-cpp.so.21.0git`clang::VarDecl::evaluateValueImpl(this=0x00007bff77ce24b0, Notes=0x00007bff7f0d1620, IsConstantInitialization=false) const at Decl.cpp:2607:23
    frame #13: 0x00007fffdde7a4a2 libclang-cpp.so.21.0git`clang::VarDecl::evaluateValue(this=0x00007bff77ce24b0) const at Decl.cpp:2583:10
    frame #14: 0x00007fffdde7a0d7 libclang-cpp.so.21.0git`clang::VarDecl::hasInitWithSideEffects(this=0x00007bff77ce24b0) const at Decl.cpp:2458:39
    frame #15: 0x00007fffe8c2e77b libclang-cpp.so.21.0git`clang::ASTDeclWriter::VisitVarDecl(this=0x00007bff7f381b50, D=0x00007bff77ce24b0) at ASTWriterDecl.cpp:1308:27
    frame #16: 0x00007fffe8c58bf8 libclang-cpp.so.21.0git`clang::declvisitor::Base<std::add_pointer, clang::ASTDeclWriter, void>::Visit(this=0x00007bff7f381b50, D=0x00007bff77ce24b0) at DeclNodes.inc:296:1
    frame #17: 0x00007fffe8c1ad7e libclang-cpp.so.21.0git`clang::ASTDeclWriter::Visit(this=0x00007bff7f381b50, D=0x00007bff77ce24b0) at ASTWriterDecl.cpp:460:31
    frame #18: 0x00007fffe8c4f5ae libclang-cpp.so.21.0git`clang::ASTWriter::WriteDecl(this=0x00007e0f83dd8608, Context=0x00007e9f839f8200, D=0x00007bff77ce24b0) at ASTWriterDecl.cpp:3060:5
    frame #19: 0x00007fffe8a908a7 libclang-cpp.so.21.0git`clang::ASTWriter::WriteDeclAndTypes(this=0x00007e0f83dd8608, Context=0x00007e9f839f8200) at ASTWriter.cpp:6243:9
    frame #20: 0x00007fffe8a805f5 libclang-cpp.so.21.0git`clang::ASTWriter::WriteASTCore(this=0x00007e0f83dd8608, SemaPtr=0x00007e8f83cd3200, isysroot=(Data = "", Length = 0), WritingModule=0x00007e0f83d5bc18) at ASTWriter.cpp:6083:5
    frame #21: 0x00007fffe8a7cfa2 libclang-cpp.so.21.0git`clang::ASTWriter::WriteAST(this=0x00007e0f83dd8608, Subject=PointerUnion<clang::Sema *, clang::Preprocessor *> @ 0x00007bff7f18e640, OutputFile=(Data = "/home/tbaeder/code/llvm-project/build/runtimes/runtimes-bins/libcxx/test/libcxx/clang_modules_include.gen.py/Output/complex.h.compile.pass.cpp.dir/t.tmp/1WNKSCAH8NSAM/std-PE20VSNDCJ1A.pcm", Length = 187), WritingModule=0x00007e0f83d5bc18, isysroot=(Data = "", Length = 0), ShouldCacheASTInMemory=true) at ASTWriter.cpp:5434:32
    frame #22: 0x00007fffe8cd2168 libclang-cpp.so.21.0git`clang::PCHGenerator::HandleTranslationUnit(this=0x00007e0f83dd8500, Ctx=0x00007e9f839f8200) at GeneratePCH.cpp:86:30
    frame #23: 0x00007fffe9595e11 libclang-cpp.so.21.0git`clang::MultiplexConsumer::HandleTranslationUnit(this=0x00007c5f83a00300, Ctx=0x00007e9f839f8200) at MultiplexConsumer.cpp:339:15
    frame #24: 0x00007fffdc94121d libclang-cpp.so.21.0git`clang::ParseAST(S=0x00007e8f83cd3200, PrintStats=false, SkipFunctionBodies=false) at ParseAST.cpp:183:13
    frame #25: 0x00007fffe9480085 libclang-cpp.so.21.0git`clang::ASTFrontendAction::ExecuteAction(this=0x00007bff7efb9020) at FrontendAction.cpp:1339:3
    frame #26: 0x00007fffe947e650 libclang-cpp.so.21.0git`clang::FrontendAction::Execute(this=0x00007bff7efb9020) at FrontendAction.cpp:1221:3
    frame #27: 0x00007fffe915a163 libclang-cpp.so.21.0git`clang::CompilerInstance::ExecuteAction(this=0x00007d2f839ef000, Act=0x00007bff7efb9020) at CompilerInstance.cpp:1055:33
    frame #28: 0x00007fffe9175bbf libclang-cpp.so.21.0git`clang::CompilerInstance::compileModule(clang::SourceLocation, llvm::StringRef, llvm::StringRef, clang::CompilerInstance&)::$_0::operator()(this=0x00007bff805225e0) const at CompilerInstance.cpp:1291:18
[...]
    frame #39: 0x00007fffa3ab2a35 libLLVM.so.21.0git`void* llvm::thread::ThreadProxy<std::tuple<void (*)(void*), (anonymous namespace)::RunSafelyOnThreadInfo*>>(Ptr=0x00007c1f839e4330) at thread.h:58:5
    frame #40: 0x000000000039933b clang++`asan_thread_start(void*) + 155
    frame #41: 0x00007fff84a7dfa8 libc.so.6`start_thread + 952
    frame #42: 0x00007fff84b01fcc libc.so.6`__clone3 + 44
```

where we encounter this declaration:
```
VarDecl 0x7bff790764b0 </[...]test-suite-install/include/c++/v1/__condition_variable/condition_variable.h:49:3, col:53> col:8 in std.condition_variable.condition_variable hidden referenced __result_max '_Rep' cinit `-CallExpr 0x7bff79077078 <col:23, col:53> 'type':'long long'
  `-ImplicitCastExpr 0x7bff79077058 <col:23, col:49> 'type (*)() noexcept' <FunctionToPointerDecay>
    `-DeclRefExpr 0x7bff79076670 <col:23, col:49> 'type () noexcept' lvalue CXXMethod 0x7bff791df1f8 'max' 'type () noexcept'
      `-NestedNameSpecifier TypeSpec 'numeric_limits<__ns_rep>':'std::numeric_limits<long long>'
```

which looks fine at first, but the declaration type does not:
```
TemplateTypeParmType 0x7bff79074dd0 '_Rep' dependent depth 0 index 0 `-TemplateTypeParm 0x7bff79074d70 '_Rep'
```
we cannot classify this, so we later run into an assertion because we
assume `PT_Ptr` while the value on the stack is of type `classify(long
long)`.

Work around this by only looking at the initializer type in that case.

For the record, the command line that crashed could be extracted from
`ninja check-cxx` and was:

```
/home/tbaeder/code/llvm-project/build/bin/clang++ /home/tbaeder/code/llvm-project/build/runtimes/runtimes-bins/libcxx/test/libcxx/clang_modules_include.gen.py/complex.h.compile.pass.cpp -pthread --target=x86_64-redhat-linux -nostdinc++ -I /home/tbaeder/code/llvm-project/build/runtimes/runtimes-bins/libcxx/test-suite-install/include/x86_64-redhat-linux/c++/v1 -I /home/tbaeder/code/llvm-project/build/runtimes/runtimes-bins/libcxx/test-suite-install/include/c++/v1 -I /home/tbaeder/code/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter
 -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -Werror=thread-safety -Wuser-defined-warnings -fmodules -fcxx-modules -fmodules-cache-path=/home/tbaeder/code/llvm-project/build/runtimes/runtimes-bins/libcxx/test/libcxx/clang_modules_include.gen.py/Output/complex.h.compile.pass.cpp.dir/t.tmp -fsyntax-only
```
2025-06-30 19:50:48 +02:00
Kazu Hirata
0494f93434 [Basic] Drop const from a return type (NFC) (#146382)
We don't need const on a return type.
2025-06-30 10:42:31 -07:00
Kazu Hirata
6a83a84ac5 [IR] Remove an unnecessary cast (NFC) (#146381)
C is already of unsigned char.
2025-06-30 10:42:24 -07:00
Uzair Nawaz
7a33b709b1 [libc] wcstok implementation (#145989)
Implemented wcstok and added tests
2025-06-30 10:41:00 -07:00
Peter Klausler
790bc5bc72 [flang][NFC] Remove inadvertently added source file (#146395)
I accidentally added "t.f90" to the top level of llvm-project.
2025-06-30 10:40:06 -07:00
Steven Perron
de7c2f2940 [HLSL] Remove dead code in Type.cpp [NFC] (#146365)
In a case statement for Type::HLSLInlineSpirv, the first statment
returns, and the remaining statement are never executed. This removes
the dead code.


7d8e369443 (r2166484730)
2025-06-30 13:31:27 -04:00
Peter Klausler
407542b3ec [flang] Process pointer component default initializers sooner (#145601)
Name resolution defers the analysis of all object pointer initializers
to the end of a specification part, including the default initializers
of derived type data pointer components. This deferment allows object
pointer initializers to contain forward references to objects whose
declarations appear later.

However, this deferment has the unfortunate effect of causing NULL
default initialization of such object pointer components when they do
not appear in structure constructors that are used as default
initializers, and their default initializers are required. So handle
object pointer default initializers of components as they appear, as
before.
2025-06-30 10:25:00 -07:00
Peter Klausler
f3d57590bf [flang] Skip over fixed form spaces when prescanning exponents & kind… (#145347)
… suffixes

When performing conditional tokenization of exponents and numeric kind
suffixes, be sure to skip over spaces in fixed form source.

Fixes https://github.com/llvm/llvm-project/issues/145333.
2025-06-30 10:22:50 -07:00
Peter Klausler
a93d843ab3 [flang] Don't warn on (0.,0.)**(nonzero noninteger) (#145179)
Folding hands complex exponentiations with constant arguments off to the
native libm, and on a least on host, this can produce spurious warnings
about division by zero and invalid arguments. Handle the case of a zero
base specially to avoid that, and also emit better warnings for the
undefined 0.**0 and (0.,0.)**0 cases. And add a test for these warnings
and the existing related ones.
2025-06-30 10:21:37 -07:00
Peter Klausler
348002e111 [flang] Check definability for logical INQUIRE specifiers (#144797)
check-io.cpp was missing checks for the definability of logical-valued
specifiers in INQUIRE statements (e.g. EXIST=), and therefore also not
noting the definitions of those variables. This could lead to bogus
warnings about undefined function result variables, and also to missed
errors about immutable objects appearing in those specifiers.

Fixes https://github.com/llvm/llvm-project/issues/144453.
2025-06-30 10:21:06 -07:00
Peter Klausler
dccc0266f4 [flang][runtime] Allow INQUIRE(IOLENGTH=) in the presence of defined I/O (#144541)
When I/O list items include instances of derived types for which defined
I/O procedures exist, ignore them.

Fixes https://github.com/llvm/llvm-project/issues/144363.
2025-06-30 10:20:39 -07:00
Andre Kuhlenschmidt
83b462af17 [flang][CLI] Have the CLI hint the flag to disable a warning (#144767)
Adds a hint to the warning message to disable a warning and updates the
tests to expect this.

Also fixes a bug in the storage of canonical spelling of error flags so
that they are not used after free.
2025-06-30 10:17:05 -07:00
Kazu Hirata
efc561c061 [CodeGen] Remove an unnecessary cast (NFC) (#146380)
E is already of Expr * and shares the same declaration among all these
cases.
2025-06-30 10:11:07 -07:00
Simon Pilgrim
529508c187 [DAG] canCreateUndefOrPoison - add handling for CTTZ/CTLZ nodes (#146361)
ISD::CTTZ/CTLZ nodes handle all input values and do not create undef/poison.

The *_ZERO_UNDEF variants will be handled in a future patch.
2025-06-30 17:48:05 +01:00
Fangrui Song
04395be630 MC: Merge MCFragment.h into MCSection.h
... due to their close relationship. MCSection's inline functions (e.g.
iterator) access MCFragment, and we want MCFragment's inline functions
to access MCSection similarly (#146307).

Pull Request: https://github.com/llvm/llvm-project/pull/146315
2025-06-30 09:41:53 -07:00