Commit Graph

432706 Commits

Author SHA1 Message Date
Vitaly Buka af77e5e4c0 [msan] Extract SetAllocaOrigin 2022-08-10 20:53:02 -07:00
Vitaly Buka d1040c455f [msan] Another try for powerpc fix after D131205 2022-08-10 20:39:25 -07:00
wanglei c437412fbc [LoongArch] Override TargetLowering::isOffsetFoldingLegal()
This patch disable GlobalAddress+Offset folding.

Differential Revision: https://reviews.llvm.org/D131491
2022-08-11 11:26:54 +08:00
jacquesguan 21bf59c92a [RISCV] Add cost model for mask vector extend and truncate instruction.
As extending from or truncating to mask vector do not use the same instructions as the normal cast, this path changed it to 2 which is the number of instructions we used.

Differential Revision: https://reviews.llvm.org/D131552
2022-08-11 10:55:43 +08:00
WANG Xuerui 0c8bfbb374 [LoongArch] Define the new-style reloc types
Differential Revision: https://reviews.llvm.org/D131467
2022-08-11 10:37:30 +08:00
Gergely Meszaros 3f801e07fa [clang-format] git-clang-format --staged should format the index
When --staged (or --cached) use the index for formatting as well, not just
for the line numbers to format. Without this change git-clang-format gets
the changed line numbers based on the index, but then formats these lines on
the working tree version of the file.

This is a problem when the working tree and index differ. One common case
would be (and is the motivation behind this patch) when applying the
suggested changes git-clang-format --staged, then forgetting to add the
applied changes. When git-clang-format --staged --diff is used in a
pre-commit hook in this scenario, then the hook would allow committing the
improperly formatted changes, as the file is correctly formatted in the work
tree.

Fixes #56797.

Differential Revision: https://reviews.llvm.org/D130108
2022-08-10 19:30:41 -07:00
Vitaly Buka 05b3374925 [msan] Try to fix powerpc after D131205 2022-08-10 19:28:30 -07:00
WANG Xuerui ed078c48f0 [LoongArch] Add insn aliases `jr` and `ret`
Differential Revision: https://reviews.llvm.org/D131512
2022-08-11 10:02:45 +08:00
Phoebe Wang f061cfb317 [compiler-rt][BF16] Provide __truncdfbf2 and __truncsfbf2 only when __bf16 is available
Differential Revision: https://reviews.llvm.org/D131147
2022-08-11 09:20:08 +08:00
Uday Bondhugula 3d93885f7c [MLIR][NFC] Refactor affine analysis helpers
Refactor affine analysis helpers: the existing ones were using
unnecessary or improperly named arguments. NFC.

Differential Revision: https://reviews.llvm.org/D131557
2022-08-11 06:28:59 +05:30
WANG Xuerui 326f7aed38 [LoongArch] Add codegen support for bitreverse
Differential Revision: https://reviews.llvm.org/D131378
2022-08-11 08:55:14 +08:00
Uday Bondhugula b6164ec9c2 [MLIR] Add missing check for unsupported affine dependence analysis
Add missing check in affine dependence analysis when dependence analysis
isn't possible due to the ops being in different affine scopes.  The
lack of such a check could lead to a crash or incorrect behavior in
several dependent utilities.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D131556
2022-08-11 06:02:39 +05:30
Uday Bondhugula 82973067ac [MLIR] Fix build breakage due to 5c5af910fe
Fix build breakage due to 5c5af910fe.

```commit 5c5af910fe
Author: Jeff Niu <jeff@modular.com>
Date:   Tue Aug 9 22:07:35 2022 -0400

    [mlir][LLVMIR] "Modernize" Insert/ExtractValueOp ```

results in

```lib/Conversion/LLVMCommon/MemRefBuilder.cpp:170:70: error: call of overloaded ‘makeArrayRef<int64_t>(<brace-enclosed initializer list>)’ is ambiguous
       llvm::makeArrayRef<int64_t>({kStridePosInMemRefDescriptor,
       pos}));

llvm/include/llvm/ADT/ArrayRef.h:505:15: note: candidate: ‘llvm::ArrayRef<T> llvm::makeArrayRef(const std::vector<T>&) [with T = long int]’
   ArrayRef<T> makeArrayRef(const std::vector<T> &Vec) {
               ^~~~~~~~~~~~
llvm/include/llvm/ADT/ArrayRef.h:516:37: note: candidate: ‘llvm::ArrayRef<T> llvm::makeArrayRef(const llvm::ArrayRef<T>&) [with T = long int]’
   template <typename T> ArrayRef<T> makeArrayRef(const ArrayRef<T> &Vec) {
                                                                      ^

Differential Revision: https://reviews.llvm.org/D131637
2022-08-11 05:58:38 +05:30
Keith Smiley 3c24fae398
[lld-macho] Add support for objc_msgSend stubs
Apple Clang in Xcode 14 introduced a new feature for reducing the
overhead of objc_msgSend calls by deduplicating the setup calls for each
individual selector. This works by clang adding undefined symbols for
each selector called in a translation unit, such as `_objc_msgSend$foo`
for calling the `foo` method on any `NSObject`. There are 2
different modes for this behavior, the default directly does the setup
for `_objc_msgSend` and calls it, and the smaller option does the
selector setup, and then calls the standard `_objc_msgSend` stub
function.

The general overview of how this works is:

- Undefined symbols with the given prefix are collected
- The suffix of each matching undefined symbol is added as a string to
  `__objc_methname`
- A pointer is added for every method name in the `__objc_selrefs`
  section
- A `got` entry is emitted for `_objc_msgSend`
- Stubs are emitting pointing to the synthesized locations

Notes:

- Both `__objc_methname` and `__objc_selrefs` can also exist from object
  files, so their contents are merged with our synthesized contents
- The compiler emits method names for defined methods, but not for
  undefined symbols you call, but stubs are used for both
- This only implements the default "fast" mode currently just to reduce
  the diff, I also doubt many folks will care to swap modes
- This only implements this for arm64 and x86_64, we don't need to
  implement this for 32 bit iOS archs, but we should implement it for
  watchOS archs in a later diff

Differential Revision: https://reviews.llvm.org/D128108
2022-08-10 17:17:17 -07:00
Vitaly Buka ad5f7895ef [test][sanitizer] Fix REQUIRES of the test
getnetent is availible from API 28
2022-08-10 16:59:40 -07:00
Vitaly Buka e87ee2f4a9 [test][sanitizer] Switch test to a different group 2022-08-10 16:59:40 -07:00
Tom Stellard 9c6c4d675b lldb: Disable unittests if llvm_gtest target does not exist
This fixes the stand-alone build configuration where LLVM_MAIN_SRC_DIR
does not exist.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D124314
2022-08-10 16:56:08 -07:00
Slava Zakharin 1d5e7a498f [flang] Support DOT_PRODUCT in late inlining.
This change inlines DOT_PRODUCT calls for real and integer types.

Differential Revision: https://reviews.llvm.org/D131538
2022-08-10 16:30:35 -07:00
Vitaly Buka 58063c8ade [test][sanitizer] Change exit code to debug llvm-avr-linux 2022-08-10 16:29:28 -07:00
Med Ismail Bennani 3f3db13525 [lldb/crashlog] Add `-V|--version` option
This patch introduces a new option to the crashlog command to get the
the script version.

Since `crashlog.py` is not actually versioned, this returns lldb's
version instead.

rdar://98392669

Differential Revision: https://reviews.llvm.org/D131542

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-08-10 16:18:46 -07:00
Vitaly Buka 27b1a8273d [test][sanitizer] Fix REQUIRES in few tests 2022-08-10 16:17:12 -07:00
Aart Bik 6b7459115f [mlir][sparse][bf16] disable two bf16 tests
Supposedly our ABI issues were fixed, per issue:
https://github.com/llvm/llvm-project/issues/55992

However, with a recent changes to bf16, these tests
fail again; not sure why yet:
https://reviews.llvm.org/D130832
https://lab.llvm.org/buildbot/#/builders/61/builds/30600

So we disable the tests for now. Issue is tracked in:
https://github.com/llvm/llvm-project/issues/57042

Differential Revision: https://reviews.llvm.org/D131621
2022-08-10 15:50:27 -07:00
Vitaly Buka 6b12043beb [test][sanitizer] Fix getgrouplist test 2022-08-10 15:48:44 -07:00
Kevin Athey 057cabd997 Remove function name from sanitize-memory-track-origins binary.
This work is being done to reduce the size of MSAN with track origins binary.

Builds upon: https://reviews.llvm.org/D131205

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D131415
2022-08-10 15:45:40 -07:00
Jan Svoboda d5fcf8a5e2 [clang][deps] NFC: Move dependency consumer into header file 2022-08-10 15:25:09 -07:00
Slava Gurevich f4c21ab8b3 [LLDB][NFC] Clean up dead code
Remove unreachable code that will never execute.

Differential Revision: https://reviews.llvm.org/D131613
2022-08-10 15:22:15 -07:00
Slava Gurevich db9322b206 [LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp
Static code inspection guided fixes for the following issues:
- dead code
- buffer not null-terminated
- null-dereference
- out-of-bounds access

Differential Revision: https://reviews.llvm.org/D131554
2022-08-10 15:16:37 -07:00
Michael Jones 3510082a1c [libc] move to combined integer converter
The functions converting integers into decimal, hexadecimal, and octal,
are all very similar. This patch moves to a combined converter to save
code size.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D131302
2022-08-10 14:48:30 -07:00
Michael Jones 42e2946f51 [libc][NFC] add arrow operator to optional
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D131610
2022-08-10 14:47:04 -07:00
Louis Dionne 497705ff27 [libc++] Reorganize the documentation of extensions for integral types 2022-08-10 17:35:08 -04:00
Evgenii Stepanov 8d3c960295 Revert "[clang][dataflow] Store DeclContext of block being analysed in Environment if available."
Use of uninitialized memory.
https://lab.llvm.org/buildbot/#/builders/74/builds/12713

This reverts commit 8a4c40bfe8.
2022-08-10 14:22:04 -07:00
Evgenii Stepanov 7587065043 Revert "[clang][dataflow] Analyze constructor bodies"
https://lab.llvm.org/buildbot/#/builders/74/builds/12713

This reverts commit 000c8fef86.
2022-08-10 14:21:56 -07:00
Evgenii Stepanov 26089d4da4 Revert "[clang][dataflow] Don't crash when caller args are missing storage locations"
https://lab.llvm.org/buildbot/#/builders/74/builds/12713

This reverts commit 43b298ea12.
2022-08-10 14:21:46 -07:00
Johannes Doerfert b65471d715 [Attributor][FIX] Visit same instructions with different scopes
If we collect potential values we need to visit a value even if we have
seen it before if the scope is different. The scope is part of the
result after all. Test included.

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

Differential Revision: https://reviews.llvm.org/D131597
2022-08-10 16:02:12 -05:00
Nico Weber 87248ba5b1 [lld/elf] Use C++17 nested namespace syntax in most places
Like D131405, but for ELF.

No behavior change.

Differential Revision: https://reviews.llvm.org/D131612
2022-08-10 16:47:30 -04:00
Naje George 7678db6ef4 [flang] Add semantics test for event_query subroutine
Reviewed By: ktras

Differential Revision: https://reviews.llvm.org/D131211
2022-08-10 13:45:34 -07:00
Martin Sebor 0dcfe7aa35 [InstCombine] Tighten up known library function signature tests (PR #56463)
Replace a switch statement used to validate arguments to known library
functions with a more consistent table-driven approach and tighten it
up.
2022-08-10 14:15:46 -06:00
Michael Jones 276e108bf9 [libc][NFC] clean int to string static templates
Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D131611
2022-08-10 13:11:29 -07:00
Martin Storsjö c843c921a1 [clang] Require strict matches for defines for PCH in GCC style directories
When clang includes a PCH, it tolerates some amount of differences
between the defines used when creating and when including the PCH
- this seems to be intentionally allowed in
c379c07240 (and later extended in
b636875196).

When using a PCH (or when picking a PCH out of a directory containing
multiple candidates) Clang used to accept the header if there were
defines on the command line when creating the PCH that are missing
when using the PCH, or vice versa, defines only set when using the
PCH.

The only cases where Clang explicitly rejected the use of a PCH
is if there was an explicit conflict between the options, e.g.
-DFOO=1 vs -DFOO=2, or -DFOO vs -UFOO.

The latter commit added a FIXME that we really should check whether
mismatched defines actually were used somewhere in the PCH, so that
the define would affect the outcome. This FIXME has stood unaddressed
since 2012.

This differs from GCC, which rejects PCH files if the defines differ
at all.

When explicitly including a single PCH file, the relaxed policy
of allowing minor differences is harmless for correct use cases
(but may fail to diagnose mismtaches), and potentially allow using
PCHs in wider cases (where the user intentionally know that the
differences in defines are harmless for the PCH).

However, for GCC style PCH directories, with a directory containing
multiple PCH variants and the compiler should pick the correct match
out of them, Clang's relaxed logic was problematic. The directory
could contain two otherwise identical PCHs, but one built with -DFOO
and one without. When attempting to include a PCH and iterating over
the candidates in the directory, Clang would essentially pick the
first one out of the two, even if there existed a better, exact
match in the directory.

Keep the relaxed checking when specificlly including one named
PCH file, but require strict matches when trying to pick the right
candidate out of a GCC style directory with alternatives.

This fixes https://github.com/lhmouse/mcfgthread/issues/63.

Differential Revision: https://reviews.llvm.org/D126676
2022-08-10 22:47:27 +03:00
Jeff Niu aa543b8094 [mlir][ods] (NFC) split out erroring format tests 2022-08-10 15:36:12 -04:00
Sanjay Patel 43dd567443 [EarlyCSE] allow flexibility in atan(-0.0) test
As discussed in the post-commit feedback for b53d44fe47,
this test was failing on AIX because atan(-0.0) results in 0.0 (positive).

Differential Revision: https://reviews.llvm.org/D131601
2022-08-10 15:02:01 -04:00
Jan Svoboda 71e32d5cf0 [clang][deps] Always generate module paths
Since D129389 (and downstream PR https://github.com/apple/llvm-project/pull/4965), the dependency scanner is responsible for generating full command-lines, including the modules paths. This patch removes the flag that was making this an opt-in behavior in clang-scan-deps.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D131420
2022-08-10 11:58:28 -07:00
Adrian Vogelsgesang 2d34cb74b5 [libc++] Implement `thread::id` comparators as free functions
So far, the `thread::id` comparators were implemented as hidden friends.
This was non-conforming and lead to incorrectly rejected C++ code, as
can be seen in the linked Github issue.

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

Differential Revision: https://reviews.llvm.org/D131430
2022-08-10 11:39:50 -07:00
Evgenii Stepanov 8ea1cf3111 Revert "[AMDGPU] SIFixSGPRCopies refactoring"
Breaks ASan tests.

This reverts commit 3f8ae7efa8.
2022-08-10 11:32:46 -07:00
Michael Jones 23ace05e0a [libc] add int to string for extended bases
The default IntegerToString class only supports base 10, this patch adds
a version which supports any base between 2 and 36 inclusive. This will
be used in an upcoming patch.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D131301
2022-08-10 11:28:14 -07:00
Michael Jones 5dd8553423 [libc] Support StringView equality tests
Previously, the integer_to_string tests used EXPECT_TRUE(.equals)
which doesn't have useful error messages. Now they properly check
equality with the EXPECT_EQ macro, which allows for comparing the
strings more naturally.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D131300
2022-08-10 11:23:53 -07:00
Shafik Yaghmour 4e458765aa [Clang] Restrict non fixed enum to a value outside the range of the enumeration values warning to context requiring a constant expression
In D131307 we allowed the diagnostic to be turned into a warning for a
transition period.

This had the side effect of triggering the warning in contexts not required to
be constant expression. This change will restrict the diagnostic to constant
expression contexts. This should reduce the fallout of this diagnostic.

Differential Revision: https://reviews.llvm.org/D131528
2022-08-10 11:12:01 -07:00
Aaron Ballman af01f717c4 Default implicit function pointer conversions diagnostic to be an error
Implicitly converting between incompatible function pointers in C is
currently a default-on warning (it is an error in C++). However, this
is very poor security posture. A mismatch in parameters or return
types, or a mismatch in calling conventions, etc can lead to
exploitable security vulnerabilities. Rather than allow this unsafe
practice with a warning, this patch strengthens the warning to be an
error (while still allowing users the ability to disable the error or
the warning entirely to ease migration). Users should either ensure the
signatures are correctly compatible or they should use an explicit cast
if they believe that's more reasonable.

Differential Revision: https://reviews.llvm.org/D131351
2022-08-10 13:54:17 -04:00
Eric Astor bc9617899c [ms] [llvm-ml] Handle OPTION PROLOGUE/EPILOGUE:NONE
Since we don't yet implement PROC's PROLOGUE and EPILOGUE support, we can safely ignore the option that disables them.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D131524
2022-08-10 17:52:15 +00:00
Yuanfang Chen ec08114133 [NFC][Clang] make AtomicConstraint::ParameterMapping const
It was not const due to the way it is initialized. This is needed for
a following patch.
2022-08-10 10:51:39 -07:00