Yevgeny Rouban [Sun, 27 Feb 2022 12:56:31 +0000 (19:56 +0700)]
[Support] Reset option to its default if its Default field is undefined
opt::setDefaultImpl() is changed to set the option value to the option
type's default if the Default field is not set. This results in option
value reset by Option::reset() or ResetAllOptionOccurrences() even if
the cl::init() is not specified.
Example:
StackOption<std::string> Str("str"); // No cl::init().
Str = "some value";
cl::ResetAllOptionOccurrences();
EXPECT_EQ("", Str); // The Str is reset.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D115433
Florian Hahn [Sun, 27 Feb 2022 12:44:07 +0000 (12:44 +0000)]
[VPlan] Add recipe to handle SCEV expansion (NFC).
This can be used to explicitly model VPValues that depend on SCEV
expansion, like the step for inductions.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D116288
Simon Pilgrim [Sun, 27 Feb 2022 11:33:14 +0000 (11:33 +0000)]
[lldb] BreakpointOptions::CommandData::CreateFromStructuredData - remove dead code + variable. NFCI.
The found_something bool is only ever read after it has always been set to true.
Looks to be a leftover debugging variable.
Fixes static analyzer warning: https://llvm.org/reports/scan-build/report-BreakpointOptions.cpp-CreateFromStructuredData-8-4055b9.html#EndPath
Simon Pilgrim [Sun, 27 Feb 2022 11:25:17 +0000 (11:25 +0000)]
[DAG] Ensure type is legal for bswap(shl(x,c)) -> zext(bswap(trunc(shl(x,c-bw/2)))) fold
As reported on D120192
Iain Sandoe [Sun, 30 Jan 2022 14:26:57 +0000 (14:26 +0000)]
[C++20][Modules][6/8] Record direct module imports.
This is a small cache to avoid having to check both Exports and
Imports.
Differential Revision: https://reviews.llvm.org/D118589
Carl Ritson [Sun, 27 Feb 2022 04:23:22 +0000 (13:23 +0900)]
[AMDGPU] Remove redundant isVALU in SIPreEmitPeephole. NFC
Remove redundant isVALU call added in D120202.
Fangrui Song [Sun, 27 Feb 2022 05:37:08 +0000 (05:37 +0000)]
[ELF] BitcodeFile: resolve defined symbols before undefined symbols
This ports D95985 for ELF relocatable object files to BitcodeFile.
Serge Pavlov [Sat, 26 Feb 2022 16:39:12 +0000 (23:39 +0700)]
[ConstantFolding] Fix folding of constrained compare intrinsics
The change fixes treatment of constrained compare intrinsics if
compared values are of vector type.
Differential revision: https://reviews.llvm.org/D110322
Benjamin Kramer [Sat, 26 Feb 2022 23:11:42 +0000 (00:11 +0100)]
[bazel] Port g95b4e88b1db3
Simon Pilgrim [Sat, 26 Feb 2022 21:24:15 +0000 (21:24 +0000)]
[clang] MarkVarDeclODRUsed - remove redundant nullptr check. NFCI.
The function has already been dereferenced the Var pointer
Sam McCall [Sat, 26 Feb 2022 20:38:25 +0000 (21:38 +0100)]
[clangd] Test fixes missing from
257559ed9
Sam McCall [Wed, 23 Feb 2022 15:59:19 +0000 (16:59 +0100)]
[clangd] Function return type hints: support lambdas, don't duplicate "->"
While here, fix an ugliness:
auto foo()->auto { return 42; }
This (silly) code gains a "-> int" hint. While correct and useful, it renders as
auto foo()->int->auto { return 42; }
which is confusing enough to do more harm than good I think.
Differential Revision: https://reviews.llvm.org/D120416
Björn Schäpers [Wed, 23 Feb 2022 06:07:13 +0000 (07:07 +0100)]
[clang-format][NFC] Rename test and remove comments
Why put "InMacros" in the name? We test other things to, and I will add
more, withut macros.
Also all our tests are regression tests.
Differential Revision: https://reviews.llvm.org/D120401
Björn Schäpers [Tue, 22 Feb 2022 22:26:17 +0000 (23:26 +0100)]
[clang-format][NFC] Remove redundant semi
All "calls" have a semi, as they should, remove the one from the macro.
Differential Revision: https://reviews.llvm.org/D120359
Benjamin Kramer [Sat, 26 Feb 2022 19:29:16 +0000 (20:29 +0100)]
Use RegisterInfo::regsOverlaps instead of checking aliases
This is both less code and faster since it doesn't have to expand all
the sub & superreg sets. NFCI.
River Riddle [Mon, 14 Feb 2022 21:39:06 +0000 (13:39 -0800)]
[PDLL] Properly error out on returning results from native constraints
PDL currently doesn't support result values from constraints, meaning we need
to error out until this is actually supported to avoid crashes.
Differential Revision: https://reviews.llvm.org/D119782
River Riddle [Mon, 14 Feb 2022 07:51:52 +0000 (23:51 -0800)]
[mlir:PDLL] Add support for C++ generation
This commits adds a C++ generator to PDLL that generates wrapper PDL patterns
directly usable in C++ code, and also generates the definitions of native constraints/rewrites
that have code bodies specified in PDLL. This generator is effectively the PDLL equivalent of
the current DRR generator, and will allow easy replacement of DRR patterns with PDLL patterns.
A followup will start to utilize this for end-to-end integration testing and show case how to
use this as a drop-in replacement for DRR tablegen usage.
Differential Revision: https://reviews.llvm.org/D119781
River Riddle [Mon, 14 Feb 2022 07:51:46 +0000 (23:51 -0800)]
[mlir:PDLL] Fix handling of unspecified operands/results on operation expressions
If the operand list or result list of an operation expression is not specified, we interpret
this as meaning that the operands/results are "unconstraint" (i.e. "could be anything").
We currently don't properly handle differentiating this case from the case of
"no operands/results". This commit adds the insertion of implicit value/type range
variables when these lists are unspecified. This allows for adding proper support
for when zero operands or results are expected.
Differential Revision: https://reviews.llvm.org/D119780
River Riddle [Mon, 14 Feb 2022 07:51:21 +0000 (23:51 -0800)]
[mlir:PDLL] Add support for PDL MLIR code generation
This commits starts to plumb PDLL down into MLIR and adds an initial
PDL generator. After this commit, we will have conceptually support
end-to-end execution of PDLL. Followups will add CPP generation to
match the current DRR setup, and begin to add various end-to-end
tests to test PDLL execution.
Differential Revision: https://reviews.llvm.org/D119779
David Green [Sat, 26 Feb 2022 17:59:02 +0000 (17:59 +0000)]
[AArch64] Cleanup and extend cast costs. NFC
Arthur O'Dwyer [Sat, 26 Feb 2022 17:44:26 +0000 (12:44 -0500)]
[libc++] [test] Re-remove C++ comments from generated files.
A merge conflict in D106124 accidentally reverted this part of
b82683b2e/D110794.
> Even if these comments have a benefit in .h files (for editors that
> care about language but can't be configured to treat .h as C++ code),
> they certainly have no benefit for files with the .cpp extension.
Martin Storsjö [Sat, 26 Feb 2022 17:28:16 +0000 (12:28 -0500)]
[libcxx] [test] Remove an incorrect XFAIL, fix CI on main
9f5f084 (D119770) made this test pass in the Windows configuration too,
but didn't update the XFAIL accordingly.
Differential Revision: https://reviews.llvm.org/D120611
Groverkss [Sat, 26 Feb 2022 16:32:12 +0000 (22:02 +0530)]
[MLIR][Presburger] Remove redundant check from hasConsistentState
This patch removes a redundant check in hasConsistentState which is always true
after introduction of PresburgerSpace.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120615
Florian Hahn [Sat, 26 Feb 2022 16:24:25 +0000 (16:24 +0000)]
[VPlan] Remove dead header-phi recipes.
This patch adds a new transform to remove dead recipes. For now, it only
removes dead recipes in the header, to keep the number tests that require
updating manageable. Future patches will extend this to remove dead
recipes across the whole plan.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D118051
Nico Weber [Sat, 26 Feb 2022 15:46:20 +0000 (10:46 -0500)]
[gn build] (manually) port
2e6ae1d3f2de more
b85f97bc00ae7 missed one file.
With this, all files listed in libcxx/include/CMakeLists.txt are
listed in this BUILD.gn file again.
Nico Weber [Sat, 26 Feb 2022 15:43:11 +0000 (10:43 -0500)]
[gn build] (manually) port
01ace074fcb6 more
410d4492e395a only hit half the added files.
Nico Weber [Sat, 26 Feb 2022 15:24:48 +0000 (10:24 -0500)]
[gn build] Define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER when building libcxx
Ports
87a82490fc6b89fd3 in a way. Has the effect of enabling warnings
when building libcxx itself, but more importantly this is required
after
5aaefa510ef0 to not get build errors when building libcxx itself.
Florian Hahn [Sat, 26 Feb 2022 14:48:45 +0000 (14:48 +0000)]
[LV] Add test with redundant cast in separate latch block.
Adds another interesting test for D118051.
Sam McCall [Sat, 26 Feb 2022 14:35:01 +0000 (15:35 +0100)]
[clangd] Support IncludeFixer or base specifiers
Nikita Popov [Sat, 26 Feb 2022 14:19:45 +0000 (15:19 +0100)]
Revert "[Driver] Default CLANG_DEFAULT_PIE_ON_LINUX to ON"
See post-commit discussion on https://reviews.llvm.org/D120305.
This change breaks the clang-ppc64le-rhel buildbot, though
there is suspicion that it's an issue with the bot. The change
also had a larger than expected impact on compile-time and
code-size.
This reverts commit
3c4ed02698afec021c6bca80740d1e58e3ee019e
and some followup changes.
Groverkss [Sat, 26 Feb 2022 13:24:19 +0000 (18:54 +0530)]
[MLIR][Presburger] Move IdKind specific insert/append
This patch moves identifier kind specific insert/append functions like
`insertDimId`, `appendSymbolId`, etc. from IntegerPolyhedron to
FlatAffineConstraints.
This change allows for a smoother transition to IntegerRelation.
This change is part of a series of patches to introduce Relations in Presburger
library.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120576
Sam McCall [Sat, 26 Feb 2022 13:21:52 +0000 (14:21 +0100)]
[clangd] Fix wrong included header. NFC
Sam McCall [Sat, 26 Feb 2022 13:08:12 +0000 (14:08 +0100)]
[clangd] Fix include-cleaner false-positive bug
For TemplateSpecializationType, we were checking the node's newness
twice, so it always failed the second test.
Fixes https://github.com/clangd/clangd/issues/1036
Benjamin Kramer [Sat, 26 Feb 2022 12:34:35 +0000 (13:34 +0100)]
[clangd] Qualify calls to std::move to silence -Wunqualified-std-cast-call. NFC.
Groverkss [Sat, 26 Feb 2022 10:57:22 +0000 (16:27 +0530)]
[MLIR][Presburger] Factor out various Space equality checks to PresburgerSpace::isEqual
This patch factors out various checks for dimension compatibility to
PresburgerSpace::isEqual and PresburgerLocalSpace::isEqual (for local
identifiers).
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120565
Arjun P [Sat, 26 Feb 2022 12:21:47 +0000 (12:21 +0000)]
[MLIR][Presburger] coalesce: add assert noting that locals are not yet supported
Nikolas Klauser [Sat, 26 Feb 2022 12:28:33 +0000 (13:28 +0100)]
[libc++] Remove recursion in basic_string::insert(const_iterator, ForwardIterator, ForwardIterator)
`__addr_in_range` is a non-constexpr function, so we can't call it during constant evaluation.
Reviewed By: Quuxplusone, #libc, miscco
Spies: miscco, libcxx-commits
Differential Revision: https://reviews.llvm.org/D119633
Benjamin Kramer [Sat, 26 Feb 2022 12:23:06 +0000 (13:23 +0100)]
[clangd] Add a missing include. NFC.
Iain Sandoe [Sun, 30 Jan 2022 14:11:57 +0000 (14:11 +0000)]
[C++20][Modules][5/8] Diagnose wrong import/export for partition CMIs.
We cannot export partition implementation CMIs, but we can export the content
of partition interface CMIs.
Differential Revision: https://reviews.llvm.org/D118588
Sam McCall [Sat, 26 Feb 2022 10:40:12 +0000 (11:40 +0100)]
[clangd] Clean up unused includes. NFCI
Add includes where needed to fix build.
Haven't systematically added used headers, so there is still accidental
dependency on transitive includes.
Itay Bookstein [Sat, 29 Jan 2022 12:33:18 +0000 (14:33 +0200)]
[Verifier] Restore defined-resolver verification for IFuncs
Now that clang no longer emits GlobalIFunc-s with a
declaration for a resolver, we can restore that check.
In addition, add a linkage check like the one we have
on GlobalAlias-es, and a Verifier test for ifuncs.
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D120267
Michel Weber [Sat, 26 Feb 2022 10:30:42 +0000 (10:30 +0000)]
[MLIR][Presburger] fix double increment in coalesce
In the main-loop of the current coalesce implementation `i` was incremented
twice for some cases. This patch fixes this bug and adds a regression
testcase.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120613
Itay Bookstein [Sat, 29 Jan 2022 12:32:54 +0000 (14:32 +0200)]
[clang][CodeGen] Avoid emitting ifuncs with undefined resolvers
The purpose of this change is to fix the following codegen bug:
```
// main.c
__attribute__((cpu_specific(generic)))
int *foo(void) { static int z; return &z;}
int main() { return *foo() = 5; }
// other.c
__attribute__((cpu_dispatch(generic))) int *foo(void);
// run:
clang main.c other.c -o main; ./main
```
This will segfault prior to the change, and return the correct
exit code 5 after the change.
The underlying cause is that when a translation unit contains
a cpu_specific function without the corresponding cpu_dispatch
the generated code binds the reference to foo() against a
GlobalIFunc whose resolver is undefined. This is invalid: the
resolver must be defined in the same translation unit as the
ifunc, but historically the LLVM bitcode verifier did not check
that. The generated code then binds against the resolver rather
than the ifunc, so it ends up calling the resolver rather than
the resolvee. In the example above it treats its return value as
an int *, therefore trying to write to program text.
The root issue at the representation level is that GlobalIFunc,
like GlobalAlias, does not support a "declaration" state. The
object which provides the correct semantics in these cases
is a Function declaration, but unlike Functions, changing a
declaration to a definition in the GlobalIFunc case constitutes
a change of the object type, as opposed to simply emitting code
into a Function.
I think this limitation is unlikely to change, so I implemented
the fix by returning a function declaration rather than an ifunc
when encountering cpu_specific, and upgrading it to an ifunc
when emitting cpu_dispatch.
This uses `takeName` + `replaceAllUsesWith` in similar vein to
other places where the correct IR object type cannot be known
locally/up-front, like in `CodeGenModule::EmitAliasDefinition`.
Previous discussion in: https://reviews.llvm.org/D112349
Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D120266
Christopher Di Bella [Fri, 25 Feb 2022 18:59:32 +0000 (18:59 +0000)]
[libcxx][modules] protects users from relying on detail headers
libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as <__ranges/access.h> instead of
<ranges>, and Hyrum's law suggests that users will eventually begin to
rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.
Differential Revision: https://reviews.llvm.org/D106124
Fangrui Song [Sat, 26 Feb 2022 07:25:44 +0000 (07:25 +0000)]
[test] Precisely disable flaky sanitizer tests on clang-ppc64le-redhat
See https://reviews.llvm.org/D120305#3347094
Craig Topper [Sat, 26 Feb 2022 05:39:03 +0000 (21:39 -0800)]
[SeparateConstOffsetFromGEP] Remove TargetMachine.h include. NFC
This doesn't appear to be used and it would be a layering violation
if it was.
Evgeniy Brevnov [Fri, 25 Feb 2022 11:09:07 +0000 (18:09 +0700)]
[SLP] "Normal" instructions should not go between PHI and Lading pad
Currently, SLP can insert "shuffle" instruction beween PHI and Landing pad instruction. The problem is demonstrated by LIT test. The solution is to adjust insertion point once we are done with PHI generation.
Differential Revision: https://reviews.llvm.org/D120552
Fangrui Song [Sat, 26 Feb 2022 04:41:49 +0000 (04:41 +0000)]
[crt][test] Add -no-pie to avoid wacky linking with crt1.o if (musl || CLANG_DEFAULT_PIE_ON_LINUX)
This works with glibc crt1.o (its crt1.o is essentially Scrt1.o plus (if static
PIE is supported for the arch) _dl_relocate_static_pie) but looks wacky.
musl crt1.o is not built with an explicit -fno-pic/-fpie/-fpic. If it was built
with a non-default-pie GCC/Clang, the linker might complain about absolute
relocations referencing _init/_fini for the -pie link:
```
ld: error: relocation R_X86_64_32 cannot be used against symbol '_fini'; recompile with -fPIC
>>> defined in obj/crt/crt1.o
>>> referenced by crt1.c
>>> obj/crt/crt1.o:(_start_c)
```
Joao Moreira [Sat, 26 Feb 2022 03:55:39 +0000 (03:55 +0000)]
[ELF][X86] Don't create IBT .plt if there is no PLT entry
https://github.com/ClangBuiltLinux/linux/issues/1606
When GNU_PROPERTY_X86_FEATURE_1_IBT is enabled, ld.lld will create .plt output
section even if there is no PLT entry. Fix this by implementing
IBTPltSection::isNeeded instead of using the default code path (which always
returns true).
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D120600
Med Ismail Bennani [Sat, 26 Feb 2022 02:33:31 +0000 (18:33 -0800)]
[lldb/Host] Fix crash in FileSystem::IsLocal
This checks `m_fs` before dereferencing it to access its`isLocal` method.
rdar://
67410058
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 26 Feb 2022 01:20:39 +0000 (17:20 -0800)]
Reland "[lldb/test] Fix TestProgressReporting.py race issue with the event listener"
This patch relands commit
3e3e79a9e4c378b59f5f393f556e6a84edcd8898, and
fixes the memory sanitizer issue described in D120284, by removing the
output arguments from the LLDB_INSTRUMENT_VA invocation.
Differential Revision: https://reviews.llvm.org/D120599
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 26 Feb 2022 00:31:46 +0000 (16:31 -0800)]
[lldb/crashlog] Fix scripted_crashlog_json.test failure
This patch should fix the test failure on scripted_crashlog_json.test.
The failure is happening because crash reporter will obfuscate the
executable path in the crashlog, if it is located inside the user's
home directory and replace it with `/USER/*/` as a placeholder.
To fix that, we can patch the placeholder with the executable path
before loading the crashlog in lldb.
This also fixes a bug where we would create another target when loading
the crashlog in a scripted process, even if lldb already had a target
for it. Now, crashlog will only create a target if there is none in lldb.
Differential Revision: https://reviews.llvm.org/D120598
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Fangrui Song [Sat, 26 Feb 2022 01:06:24 +0000 (01:06 +0000)]
[Driver][test] Clean up some AIX tests
* For `-###`, `-o %t.o` is unnecessary if we don't specifically test the
output filename.
* --target= is the canonical spelling. -target is a legacy spelling which
unfortunately cannot be removed because there are too many uses.
* -no-canonical-prefixes uses the dereferenced absolute path for the cc1
command. For most tests "-cc1" is sufficient to identify the command line, no
need to specifically test the "clang" command, and -no-canonical-prefixes can
removed.
* --unwindlib= is the preferred spelling. -u is a short option taking a value,
which means a -uwindlib= typo cannot be detected.
I recommend that you take a look at linux-cross.cpp. Testing include paths and
library paths in one RUN line is sometimes more readable than having separate
include/library tests.
Having separate RUN lines for misc features like -fdata-sections
(`aix-data-sections.c`) is wasteful. It may be better testing multiple
options in a single RUN command.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D119309
Adrian Prantl [Sat, 26 Feb 2022 01:00:10 +0000 (17:00 -0800)]
Revert "Don't append the working directory to absolute paths"
This reverts commit
2cd9a86da54f8be4eb2aff3e766b125cbdeb023f.
Aart Bik [Thu, 24 Feb 2022 17:40:01 +0000 (09:40 -0800)]
[mlir][sparse] merge ifs in new sparse rewriting rules
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D120500
Aart Bik [Fri, 25 Feb 2022 21:18:50 +0000 (13:18 -0800)]
[mlir][sparse] enable scalar test
Removed TODO now that we support scalars properly
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D120590
Reid Kleckner [Fri, 25 Feb 2022 22:52:38 +0000 (14:52 -0800)]
[BPF] Fix tests that fail if /tmp/t.c exists
IMO the BPF backend shouldn't read random source files referenced from
debug info. I filed llvm.org/pr54092 about this.
Elia Geretto [Fri, 25 Feb 2022 22:49:13 +0000 (14:49 -0800)]
[NewPM] Fix tests for OptimizerLast extension point
This PR fixes the tests for the `OptimizerLast` extension point in the new pass manager. The extension point uses module passes, but it was being tested with a function pass.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D120581
Elia Geretto [Fri, 25 Feb 2022 20:02:37 +0000 (12:02 -0800)]
[NewPM] Add extension points to LTO pipeline in PassBuilder
This PR adds two extension points to the default LTO pipeline in PassBuilder, one at the beginning and one at the end. These two extension points already existed in the old pass manager, the aim is to replicate the same functionality in the new one.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D120491
Bixia Zheng [Fri, 25 Feb 2022 17:28:39 +0000 (09:28 -0800)]
[mlir][sparse][taco] Support reduction to scalar tensors.
The PyTACO DSL doesn't support reduction to scalars. This change
enhances the MLIR-PyTACO implementation to support reduction to scalars.
Extend an existing test to show the syntax of reduction to scalars and
two methods to retrieve the scalar values.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D120572
Reid Kleckner [Thu, 24 Feb 2022 23:31:46 +0000 (15:31 -0800)]
[Symbolizer] Move default ctor into .cpp file
Follow up to
1e396affca6a0d21247d960c93a415e8f6fe0301. On some standard
library configurations these have a dependency on the complete type of
SymbolizableModule.
Amanieu d'Antras [Fri, 25 Feb 2022 22:06:47 +0000 (22:06 +0000)]
[Mangler] Mangle aliases to fastcall/vectorcall functions correctly
These aliases are produced by MergeFunctions and need to be mangled according to the calling convention of the function they are pointing to instead of defaulting to the C calling convention.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D120382
Xiaodong Liu [Fri, 25 Feb 2022 21:50:34 +0000 (21:50 +0000)]
[Triple] Add llvm::Triple::isSPARC{,32,64}
Reviewed By: ro, MaskRay
Differential Revision: https://reviews.llvm.org/D120381
Martin Storsjö [Thu, 20 Jan 2022 22:38:52 +0000 (22:38 +0000)]
[libcxx] Fix the error checking for wctob_l, fixing locale narrow function on Windows
According to POSIX.1 (and Glibc docs, and Microsoft docs), the wctob
function returns EOF on error, not WEOF. (And wctob_l should consequently
do the same.)
The previous misconception about what this function returns on errors
seems to stem from incorrect documentation in macOS, stemming from BSD
docs with the same issue. The corresponding documentation bug in FreeBSD
was fixed in 2012 in
https://github.com/freebsd/freebsd-src/commit/
945aab90991bdaeabeb6ef25112975a96c01dd4e,
but it hasn't been fixed for macOS yet.
The issue seems to only be a documentation issue; the implementation
on macOS actually does use EOF, not WEOF:
https://opensource.apple.com/source/Libc/Libc-1439.40.11/locale/FreeBSD/wctob.c.auto.html
On most Unices, EOF and WEOF are the same value, but on Windows,
EOF is -1, while WEOF is (unsigned short)0xFFFF. By fixing this,
two tests start passing on Windows.
Differential Revision: https://reviews.llvm.org/D120088
Martin Storsjö [Thu, 13 Jan 2022 13:02:16 +0000 (13:02 +0000)]
[libcxx] [test] Fix the monetary locale negative_sign test for en_US.UTF-8 on Windows
On Windows, the en_US.UTF-8 locale returns `n_sign_posn == 0`, which
means that the sign for a negative currency is parentheses around
the whole value, instead of a leading minus.
Differential Revision: https://reviews.llvm.org/D120549
Jonas Devlieghere [Fri, 25 Feb 2022 21:23:28 +0000 (13:23 -0800)]
[lldb] Fix check for TARGET_OS_IPHONE
Instead of checking whether TARGET_OS_IPHONE is set to 1, the current
code just check the existence of TARGET_OS_IPHONE, which either always
succeeds or always fails, depending on whether you have
TargetConditionals.h included.
Jonas Devlieghere [Fri, 25 Feb 2022 19:37:03 +0000 (11:37 -0800)]
[dsymutil] Copy symbol table regardless of LINKEDIT segment
Ensure we copy the symbol table for MH_PRELOAD Mach-Os, which don't have
a LINKEDIT segment, but (can) have a symbol table.
rdar://
88919473
Differential revision: https://reviews.llvm.org/D120583
Adrian Prantl [Fri, 25 Feb 2022 19:43:44 +0000 (11:43 -0800)]
Validate chained fixup image formats
This is part of a series of patches to upstream support for Mach-O
chained fixups.
Differential Revision: https://reviews.llvm.org/D113725
Adrian Prantl [Fri, 25 Feb 2022 19:38:16 +0000 (11:38 -0800)]
Don't append the working directory to absolute paths
This fixes a bug that happens when using -fdebug-prefix-map to remap
an absolute path to a relative path. Since the path was absolute
before remapping, it is safe to assume that concatenating the remapped
working directory would be wrong.
Differential Revision: https://reviews.llvm.org/D113718
owenca [Thu, 24 Feb 2022 18:15:11 +0000 (10:15 -0800)]
[clang-format] Handle trailing comment for InsertBraces
Differential Revision: https://reviews.llvm.org/D120503
Jameson Nash [Fri, 25 Feb 2022 20:20:22 +0000 (15:20 -0500)]
Enable tests from rG8e67982384d4a11892c04d16c2d10d7533e56094 that seem to work now
I noticed randomly that the only reason these tests from
rG8e67982384d4a11892c04d16c2d10d7533e56094 seemed to still be failing is
that they are missing CHECK lines. I don't know anymore than that they
don't appear to crash or assert when I ran them today.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D115377
Yaxun (Sam) Liu [Fri, 25 Feb 2022 13:58:23 +0000 (08:58 -0500)]
[HIP] Fix test hip-link-bundled-archive.hip
match pattern should match lld.exe on windows
Reviewed by: Shangwu Yao
Differential Revision: https://reviews.llvm.org/D120563
Valentin Clement [Fri, 25 Feb 2022 20:05:09 +0000 (21:05 +0100)]
[flang] Lower logical comparison and logical operations
This handles the lowering of the logical comparison
to `arith.cmpi` operation. The logical operations `.OR.`, `.AND.`
and `.NOT.` are lowered to `arith.ori`, `arith.andi` and `arith.xori`
This patch is part of the upstreaming effort from fir-dev branch.
Depends on D120559
Reviewed By: schweitz, rovka
Differential Revision: https://reviews.llvm.org/D120560
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Valentin Clement [Fri, 25 Feb 2022 20:02:53 +0000 (21:02 +0100)]
[flang] Lower real comparison operations
This patch handles the lowering of real
comparison operations. The real comparison operations
are lowered to `arith.cmpf` operation.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D120561
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Valentin Clement [Fri, 25 Feb 2022 20:00:07 +0000 (21:00 +0100)]
[flang] Lower integer comparison operation
This patch handles the lowering of comprison
operator between integers.
The comparison is lowered to a `arith.cmpi` operation.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz, rovka
Differential Revision: https://reviews.llvm.org/D120559
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Fangrui Song [Fri, 25 Feb 2022 19:55:56 +0000 (19:55 +0000)]
[libunwind][test] remember_state_leak.pass.sh.s: link with -no-pie
The no-pic large code model style `movabsq $callback, %rsi` does not work with -pie.
Hanhan Wang [Fri, 25 Feb 2022 18:52:08 +0000 (10:52 -0800)]
[mlir][Linalg] Add support for tileFuseAndDistribute on tensors.
This extends TileAndFuse to handle distribution on tensors.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D120441
Craig Topper [Fri, 25 Feb 2022 19:36:23 +0000 (11:36 -0800)]
[RISCV] Remove tab character from test. Autogenerate CHECK lines. NFC
This was a test for an infinite loop so the CHECK lines don't really
matter, but they'd get generated the next time someone runs the script
on the file so might as well do it while I'm touching it.
Jameson Nash [Fri, 25 Feb 2022 19:24:42 +0000 (14:24 -0500)]
mark getTargetTransformInfo and getTargetIRAnalysis as const
Seems like this can be const, since Passes shouldn't modify it.
Reviewed By: wsmoses
Differential Revision: https://reviews.llvm.org/D120518
Diego Caballero [Fri, 25 Feb 2022 18:27:43 +0000 (18:27 +0000)]
[mlir][Vector] Prevent AVX2 lowering for non-f32 transpose ops
The AVX2 lowering for transpose operations is only applicable to f32 vector types.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D120427
Diego Caballero [Fri, 25 Feb 2022 18:26:37 +0000 (18:26 +0000)]
[mlir][Vector] Generalize AVX2 transpose lowering to n-D vectors
The existing AVX2 lowering patterns for the transpose op only triggers if the
input vector is 2-D. This patch extends the patterns to trigger for n-D vectors
which are effectively 2-D vectors (e.g., vector<1x4x1x8x1). The main constraint
for the generalized AVX2 patterns to be applicable to these vectors is that the
dimensions that are greater than one must be transposed. Otherwise, the existing
patterns are not applicable.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D119505
Fangrui Song [Fri, 25 Feb 2022 19:25:18 +0000 (19:25 +0000)]
[ELF] Support some absolute/PC-relative relocation types for REL format
ctfconvert seems to use REL-format `.rel.SUNW_dof` for 32-bit architectures.
```
Binary file usr/ports/lang/perl5.32/work/perl-5.32.1/dtrace_mini.o matches
[alfredo.junior@dell-a ~/tmp/llvm-bug]$ readelf -r dtrace_mini.o
Relocation section (.rel.SUNW_dof):
r_offset r_info r_type st_value st_name
00000184 0000281a R_PPC_REL32
00000000 $dtrace1772974259.Perl_dtrace_probe_load
```
Support R_PPC_REL32 to fix `ld.lld: error: drti.c:(.SUNW_dof+0x4E4): internal linker error: cannot read addend for relocation R_PPC_REL32`.
While here, add some common relocation types for AArch64, PPC, and PPC64.
We perform minimum tests.
Reviewed By: adalava, arichardson
Differential Revision: https://reviews.llvm.org/D120535
Chia-hung Duan [Fri, 25 Feb 2022 18:17:30 +0000 (18:17 +0000)]
[mlir] Support verification order (2/3)
This change gives explicit order of verifier execution and adds
`hasRegionVerifier` and `verifyWithRegions` to increase the granularity
of verifier classification. The orders are as below,
1. InternalOpTrait will be verified first, they can be run independently.
2. `verifyInvariants` which is constructed by ODS, it verifies the type,
attributes, .etc.
3. Other Traits/Interfaces that have marked their verifier as
`verifyTrait` or `verifyWithRegions=0`.
4. Custom verifier which is defined in the op and has marked
`hasVerifier=1`
If an operation has regions, then it may have the second phase,
5. Traits/Interfaces that have marked their verifier as
`verifyRegionTrait` or
`verifyWithRegions=1`. This implies the verifier needs to access the
operations in its regions.
6. Custom verifier which is defined in the op and has marked
`hasRegionVerifier=1`
Note that the second phase will be run after the operations in the
region are verified. Based on the verification order, you will be able to
avoid verifying duplicate things.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D116789
Alexey Bataev [Thu, 1 Jul 2021 11:16:56 +0000 (04:16 -0700)]
[OPENMP]Fix PR50347: Mapping of global scope deep object fails.
Changed the we handle llvm::Constants in sizes arrays. ConstExprs and
GlobalValues cannot be used as initializers, need to put them at the
runtime, otherwise there wight be the compilation errors.
Differential Revision: https://reviews.llvm.org/D105297
Fangrui Song [Fri, 25 Feb 2022 18:50:39 +0000 (18:50 +0000)]
Revert "[lsan][test] Temporarily disable ppc64 and ppc64le to appease clang-ppc64le-rhel"
This reverts commit
cb76c4d71c41bbbae47852d7980e74b57c5a28df.
The failures were in test/sanitizer_common, not in test/lsan.
Fangrui Song [Fri, 25 Feb 2022 18:49:10 +0000 (18:49 +0000)]
[compiler-rt][test] Temporarily disable ppc64 and ppc64le test/sanitizer_common and test/crt
to appease clang-ppc64le-rhel: https://github.com/llvm/llvm-project/issues/54084
Changpeng Fang [Fri, 25 Feb 2022 18:45:35 +0000 (10:45 -0800)]
[AMDGPU][NFC]: Emit metadata for hidden_heap_v1 kernarg
Summary:
Emit metadata for hidden_heap_v1 kernarg
Reviewers:
sameerds, b-sumner
Fixes:
SWDEV-307188
Differential Revision:
https://reviews.llvm.org/D119027
Alexander Yermolovich [Fri, 25 Feb 2022 18:31:22 +0000 (10:31 -0800)]
[BOLT][DWARF] Fix how DW_AT_high_pc [DW_FORM_udata] is handled
We were not handling correctly conversion from DW_AT_high_pc into DW_AT_ranges,
when size of DW_AT_high_pc is not 4/8 bytes.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D120528
Fangrui Song [Fri, 25 Feb 2022 18:25:45 +0000 (18:25 +0000)]
[lsan][test] Temporarily disable ppc64 and ppc64le to appease clang-ppc64le-rhel
Seems that ppc64 lsan doesn't work with default PIE (see D120305):
https://lab.llvm.org/buildbot/#/builders/57/builds/15506
Arthur Eubanks [Fri, 25 Feb 2022 17:46:05 +0000 (09:46 -0800)]
[NFC] Remove unnecessary function pass managers
Florian Hahn [Fri, 25 Feb 2022 17:59:44 +0000 (17:59 +0000)]
[AArch64] Add tests for tbl + cmp splitting.
Additional tests showing potential for follow-ups after
D120571.
Kiran Chandramohan [Fri, 25 Feb 2022 17:30:44 +0000 (17:30 +0000)]
Lower Fortran intrinsic to a runtime call/llvm intrinsic
This patch brings in code which can lower a Fortran intrinsic to
a runtime call or an llvm intrinsic. For math intrinsics the
runtime call is to the `math` or `pgmath` library. Non-math
intrinsics are covered by the Flang runtime. A distance computation
mechanism is introduced to find the runtime function that closely
matches the types of the intrinsic call.
In this patch, the `abs` intrinsic is lowered in the following way,
-> Integer version is lowered as a group of MLIR/FIR operations
-> Real version is lowered to llvm intrinsics
-> Complex version is lowered to the `math_hypot` runtime function
This patch is part of upstreaming from the fir-dev branch of https://github.com/flang-compiler/f18-llvm-project
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D120403
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: zacharyselk <zrselk@gmail.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Rong Xu [Fri, 25 Feb 2022 17:05:06 +0000 (09:05 -0800)]
[Sample-PGO] Emit FS discriminators only when -fdebug-info-for-profiling is set
IR level addDiscriminator pass is guarded by DebugInfoForProfiling
(set by option -fdebug-info-for-profiling).
This patch syncs the logic for the MIR and IR level implementations.
Differential Revision: https://reviews.llvm.org/D120536
Stefan Pintilie [Fri, 25 Feb 2022 17:16:04 +0000 (11:16 -0600)]
[PowerPC][NFC] Split out the MMA instructions from the P10 instructions.
Currently all of the MMA instructions as well as the MMA related register info
is bundled with the Power 10 instructions. This patch just splits them out.
Reviewed By: lei
Differential Revision: https://reviews.llvm.org/D120515
Aakanksha [Fri, 25 Feb 2022 17:30:12 +0000 (17:30 +0000)]
Avoid comparisons between types of different widths in a loop condition to prevent the loop from behaving unexpectedly
This change fixes the code violations flagged in AMD compute CodeQL scan -
Query Description: "Comparisons between types of different widths in a loop condition can cause the loop to behave unexpectedly."
Differential Revision: https://reviews.llvm.org/D120355
Valentin Clement [Fri, 25 Feb 2022 17:21:44 +0000 (18:21 +0100)]
[flang] Lower simple character return
Handles function with character return.
Character scalar results are passed as arguments in lowering so
that an assumed length character function callee can access the result
length.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld, schweitz
Differential Revision: https://reviews.llvm.org/D120558
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
David Green [Fri, 25 Feb 2022 17:11:24 +0000 (17:11 +0000)]
[AArch64] Add scalar min/max costs. NFC
The vector costs were already added, this adds scalar variants to
complete the test coverage.
Paul Walker [Thu, 24 Feb 2022 16:50:54 +0000 (16:50 +0000)]
[SVE] Add missing splat patterns for bfloat vectors.
Differential Revision: https://reviews.llvm.org/D120496
Nikita Popov [Fri, 25 Feb 2022 16:36:29 +0000 (17:36 +0100)]
[MergeICmps] Don't require GEP
With opaque pointers, the zero-offset load will generally not use
a GEP. Allow a direct load without GEP, which is treated the same
way as a zero-offset GEP.
Stefan Pintilie [Fri, 25 Feb 2022 16:19:19 +0000 (10:19 -0600)]
[PowerPC][NFC] Add file info and license that was missing from this file.
Added the license info as well as description about how classes should be named
based on existing documentation.
Reviewed By: lei, #powerpc
Differential Revision: https://reviews.llvm.org/D120530