Commit Graph

409226 Commits

Author SHA1 Message Date
Lang Hames 1d82e19f37 [ORC-RT] Add debug logging macros.
Inspired by LLVM_DEBUG, but using environment variables rather than command line
options.

Code can use ORC_RT_DEBUG(...) (if ORC_RT_DEBUG_TYPE is set), or
ORC_RT_DEBUG_WITH_TYPE(<type>, ...) (if ORC_RT_DEBUG_TYPE is not set. E.g. in
headers).

Debug logging is enabled in the executor by setting the ORC_RT_DEBUG environment
variable. Debug logging can be restricted by type by setting the
ORC_RT_DEBUG_TYPES environment variable to a comma separated list of types,
e.g. ORC_RT_DEBUG_TYPES=macho_platform,sps.

Differential Revision: https://reviews.llvm.org/D116139
2022-01-08 17:28:02 +11:00
Lang Hames 5b93069116 [ORC] Add missing header from 089acf2522. 2022-01-08 17:28:02 +11:00
Lang Hames 089acf2522 [ORC][JITLink] Merge JITLink AllocActionCall and ORC WrapperFunctionCall.
These types performed identical roles. Merging them simplifies interoperability
between JITLink and ORC APIs (allowing us to address a few FIXMEs).
2022-01-08 16:46:15 +11:00
Kazu Hirata 9d74582810 [Target] use range-based for loops (NFC) 2022-01-07 21:20:36 -08:00
owenca d97025ad3a [clang-format][NFC] Fix a bug in getPreviousToken() in the parser
Differential Revision: https://reviews.llvm.org/D116318
2022-01-07 21:12:18 -08:00
Tanya Lattner 645c845d45 Add first draft of the discourse migration guide. 2022-01-07 20:24:35 -08:00
Craig Topper 042394b69e [RISCV] Add a command line option to control the LMUL used by TTI's getRegisterBitWidth.
By default we return the width of an LMUL=1 register. We can enable
testing with larger LMUL values by returning a larger bit width.

This patch adds a RISCV specific option to provide a LMUL which will be
multiplied by the LMUL=1 bit width.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D116339
2022-01-07 20:02:10 -08:00
Kazu Hirata 4e2ec7e38d [llvm] Remove unused forward declarations (NFC) 2022-01-07 20:00:34 -08:00
Kito Cheng f142c45f1e [RISCV] Set getMinVectorRegisterBitWidth to 16 if enable fixed length vector code gen for RVV
getMinVectorRegisterBitWidth means what vector types is supported in
this target, and actually RISC-V support all fixed length vector types with
vector length less than `getMinRVVVectorSizeInBits`, so set it to 16,
means 2 x i8, that is minimal fixed length vector size in theory.

That also fixed one issue, some testcase migth become non-vectorizable
when `-riscv-v-vector-bits-min` set to larger value, because the vector size is
smaller than `-riscv-v-vector-bits-min`.

For example, following code can vectorize by SLP with
`-riscv-v-vector-bits-min=128` or `-riscv-v-vector-bits-min=256`, but
can't vectorize `-riscv-v-vector-bits-min=512` or larger:

```
void foo(double *da) {
  da[0] = 0;
  da[1] = 1;
  da[2] = 2;
  da[3] = 3;
}
```

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D116534
2022-01-08 11:16:21 +08:00
Jun Zhang 5be131922c
[NFC] Test commit.
This is just a test commit to check whether the permission I got is
correct or not.
2022-01-08 10:36:09 +08:00
Mehdi Amini 3e13c4c37c Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set
a32300a changed it to create a ThreadPool eagerly so that it gets reused
across buffers, however it also made it so that we create a ThreadPool
early even if we're not gonna use it later because of the command line
option `--mlir-disable-threading` is provided.

Fix #53056

Reland 45adf60802 after build fixes

Differential Revision: https://reviews.llvm.org/D116848
2022-01-08 02:26:41 +00:00
Mehdi Amini 4938949310 Revert "Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set"
This reverts commit 45adf60802.
Build is broken
2022-01-08 02:25:18 +00:00
Nico Weber 19c37223d7 [gn build] (manually) port feeff8a37c
This reverts commit 3ca6928344.
492de35df4 relanded in feeff8a37c.
The reland only uses CMAKE_INSTALL_INCLUDEDIR and not CMAKE_INSTALL_BINDIR
in llvm-config, so this reland reflects that.
2022-01-07 21:22:08 -05:00
John Demme d9547f410f [MLIR] Fix compilation with LLVM_ENABLE_THREADS=OFF
Currently, compiles with LLVM_ENABLE_THREADS=OFF fail due to this symbol missing. Add it but assert as calling code is (and should be) checking that threading is enabled.

Differential Revision: https://reviews.llvm.org/D116846
2022-01-08 02:21:03 +00:00
Mehdi Amini 45adf60802 Avoid creating a ThreadPool in MlirOptMain when `--mlir-disable-threading` option is set
a32300a changed it to create a ThreadPool eagerly so that it gets reused
across buffers, however it also made it so that we create a ThreadPool
early even if we're not gonna use it later because of the command line
option `--mlir-disable-threading` is provided.

Fix #53056

Differential Revision: https://reviews.llvm.org/D116848
2022-01-08 02:18:19 +00:00
Ben Wagner fb1582f6c5 [libc++] Disable coverage with sanitize-coverage=0
When building libcxx, libcxxabi, and libunwind the build environment may
specify any number of sanitizers. For some build feature tests these
sanitizers must be disabled to prevent spurious linking errors. With
-fsanitize= this is straight forward with -fno-sanitize=all. With
-fsanitize-coverage= there is no -fno-sanitize-coverage=all, but there
is the equivalent undocumented but tested -fsanitize-coverage=0.

The current build rules fail to disable 'trace-pc-guard'. By disabling
all sanitize-coverage flags, including 'trace-pc-guard', possible
spurious linker errors are prevented. In particular, this allows libcxx,
libcxxabi, and libunwind to be built with HonggFuzz.

CMAKE_REQUIRED_FLAGS is extra compile flags when running CMake build
configuration steps (like check_cxx_compiler_flag). It does not affect
the compile flags for the actual build of the project (unless of course
these flags change whether or not a given source compiles and links or
not). So libcxx, libcxxabi, and libunwind will still be built with any
specified sanitize-coverage as before. The build configuration steps
(which are mostly checking to see if certain compiler flags are
available) will not try to compile and link "int main() { return 0;}"
(or other specified source) with sanitize-coverage (which can fail to
link at this stage in building, since the final compile flags required
are yet to be determined).

The change to LIBFUZZER_CFLAGS was done to keep it consistent with the
obvious intention of disabling all sanitize-coverage. This appears to
be intentional, preventing the fuzzer driver itself from showing up in
any coverage calculations.

Reviewed By: #libunwind, #libc, #libc_abi, ldionne, phosek

Differential Revision: https://reviews.llvm.org/D116050
2022-01-07 17:53:21 -08:00
Kazu Hirata b932bdf59f [llvm] Remove redundant member initialization (NFC)
Identified with readability-redundant-member-init.
2022-01-07 17:45:09 -08:00
Julian Lettner bdef75fd61 [Darwin][Sanitizer] Lower Python requirement for iOS simulator testing
Lower Python requirements: 3.7 -> 3.6

Workaround introduced in: ebd8eee62a
2022-01-07 17:37:29 -08:00
Vitaly Buka 244dd2913a Don't pass uninitialized QueryKind
Even if findImplementors does not use
uninitialized parameter it's still UB and
it's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116827
2022-01-07 17:14:08 -08:00
Julian Lettner ebd8eee62a [Darwin] Apply workaround to make symbolication in iOS simulators work
Specify `ASAN_SYMBOLIZER_PATH` when running simulator tests.  This will
unblock simulator testing in GreenDragon (Apple's open source testing).
2022-01-07 16:49:12 -08:00
John Ericson feeff8a37c [llvm] Use `GNUInstallDirs` to support custom installation dirs
This is the patch for LLVM proper in my series for adding GNUInstallDirs support in all project.

Additionally:

Create a new `CACHE STRING` variable, `LLVM_EXAMPLES_INSTALL_DIR`, to control where the examples are installed on analogy with the other variables.

---

This patch supersedes D28234, which tried to do the same thing but hand-rolled without GNUInstallDirs.

This patch nearly reverts commit 3 0fc88bf1dc15a72e2d9809d28019d386b7a7cc0, which was a revert of a prior attempt."

(I had to add a space here or else Phabricator detects a reference cycle and won't let me do the form submit.)

Reviewed By: compnerd

Differential Revision: https://reviews.llvm.org/D100810
2022-01-08 00:47:31 +00:00
Yuanfang Chen d6d3000a2f [CMake][WinMsvc] Fix user passed compiler/linker flags
Users could pass flags by environment variables like CFLAGS/CXXFLAGS/LDFLAGS
or by using CMAKE_<LANG>_FLAGS_INIT/CMAKE_<t>_LINKER_FLAGS_INIT. So this
toolchain file should append to INIT flags instead. Otherwise, user
flags would be discarded here by assigning to CMAKE_<LANG>_FLAGS
directly.

Reviewed By: smeenai, mstorsjo

Differential Revision: https://reviews.llvm.org/D116709
2022-01-07 16:34:56 -08:00
Walter Erquinigo 69c8e64ba6 [formatters] Improve documentation
This adds some important remarks to the data formatter documentation.

Differential Revision: https://reviews.llvm.org/D115974
2022-01-07 16:27:03 -08:00
Jonas Devlieghere d13da5f0da [lldb] Remove lldbconfig module
The lldbconfig module was necessary to run the LLDB test suite against a
reproducer. Since this functionality has been removed, the module is no
longer necessary.
2022-01-07 15:58:43 -08:00
John Ericson cb992f9158 Make separate config variable for `LLVM_LIBRARY_DIRS`
@beanz tells me it should in fact exists, and it would be bad to put a
list of dirs in `LLVM_LIBRARY_DIR`. I am therefore making some changes
to help avoid this an other mistakes:

- Use a separate `LLVM_CONFIG_LIBRARY_DIR` (no "S") variable so we don't
  start putting a list in `LLVM_LIBRARY_DIR` by mistake.

- Define the individual dir variables first, and the define the list of
  dirs variables programmatically.

Also, I rearranged the definitions of the "regular" single dirs below so
`LLVM_BINARY_DIR`, which is the unsuffixed one, comes first before the
suffixed ones.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D116497
2022-01-07 23:54:32 +00:00
Baoshan Pang af931a51b9 [RISCV] Materializing constants with 'rori'
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D116574
2022-01-07 15:39:22 -08:00
Vitaly Buka 5c46c1c23a Initialize output parameter
Or code like this have UB passing uninitialized CmpValue:

```
  int64_t CmpMask, CmpValue;
  if (!TII->analyzeCompare(MI, SrcReg, SrcReg2, CmpMask, CmpValue))
    return false;
  if (TII->optimizeCompareInstr(MI, SrcReg, SrcReg2, CmpMask, CmpValue, MRI)) {
```

Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116831
2022-01-07 15:21:22 -08:00
Vitaly Buka bd9ae596d8 Initialize ExtAddrMode::Scale
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116830
2022-01-07 15:21:22 -08:00
Vitaly Buka 91cb471c4b Initialize fields of TypeRecord subclasses
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116829
2022-01-07 15:21:22 -08:00
Vitaly Buka 669eb60046 Initialize HighlightingsBuilder::Resolver
Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116828
2022-01-07 15:21:22 -08:00
Vitaly Buka ee43259cbc Initialize output parameters
If the function returns true, it should
set all output paremeters, similar to Output::preflightElement, or we
have UB on code like:

```
void *SaveInfo;
if (io.preflightFlowElement(i, SaveInfo))
  io.postflightFlowElement(SaveInfo);
```

It's going to be detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116826
2022-01-07 15:21:21 -08:00
Sumanth Gundapaneni ec2945d031 [Hexagon] Reconize M2_mnaci in HexagonBitTracker 2022-01-07 14:48:29 -08:00
Amy Huang 28d2977ff2 [-fms-extensions] Make some exception specification warnings/errors compatible with what cl.exe does
Make clang-cl error when a function definition is missing 'noexcept',
and succeed without warnings when missing '__declspec(nothrow)' or 'throw'.

Fixes pr52860

Differential Revision: https://reviews.llvm.org/D116256
2022-01-07 14:42:16 -08:00
Nick Desaulniers 3a604fdbcd [Clang][CFG] check children statements of asm goto
When performing CFG based analyses, don't forget to check the child
statements of an asm goto, such as the expressions used for
inputs+outputs.

Fixes: https://github.com/llvm/llvm-project/issues/51024
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1439

Reviewed By: void, jyknight, jyu2, efriedma

Differential Revision: https://reviews.llvm.org/D116059
2022-01-07 14:11:08 -08:00
Philip Reames f38873537b [MemoryBuiltin] Cleanup stale todo comments [NFC]
strdup/strndup are already partially implemented, move remaining comment to relevant place.  Remaining named routines are copy routines and mostly handled via intrinsics already - they do not allocate new memory.
2022-01-07 13:57:20 -08:00
Jonas Devlieghere ab7618914d [lldb] Use lit_config.note to print module cache message 2022-01-07 13:35:18 -08:00
Groverkss 74903059b2 [MLIR] Add IntegerPolyhedron::getUniverse
This operation already exists in FlatAffineConstraints but is added to
IntegerPolyhedron to keep consistancy in available methods.
2022-01-08 02:59:56 +05:30
Roman Lebedev 32300375f5
[NFCI] `ScalarEvolution::getRangeRef()`: collapse `SCEVMinMaxExpr` handling 2022-01-08 00:23:08 +03:00
Arthur Eubanks f96ab6cc1b Revert "[Inline] Attempt to delete any discardable if unused functions"
This reverts commit 335a3163aa.

Causes crashes when building llvm-test-suite's kc under ReleaseLTO-g.
2022-01-07 13:12:40 -08:00
Krzysztof Parzyszek 07ecb98798 [Hexagon] Use map from HexagonDepArch instead of local one, NFC
Co-authored-by: Brian Cain <bcain@quicinc.com>
2022-01-07 13:02:57 -08:00
John Ericson a1da5f3c2d [lld] Deprecate using llvm-config to detect llvm installation
This is continuing in the path of D51714, which did this for Clang.

I have rearranged the source code Clang so one can diff the top-level
CMakeLists.txt of Clang and LLD, ensuring we use the same strategy for
both.

Besides diffing the two files, `git diff --color-moved` on LLD also helps review.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D116492
2022-01-07 20:51:14 +00:00
Shafik Yaghmour 4f6d3a376c [LLDB] Fix setting of success in Socket::Close()
Both close and closesocket should return 0 on success so using !! looks incorrect. I replaced this will a more readable == 0 check.

Differential Revision: https://reviews.llvm.org/D116768
2022-01-07 12:42:58 -08:00
Adrian Prantl 81f8345ac4 Update DWARF fission extension attributes
This patch brings the transitional DWARF 4 + fission attributes up to date.

Patch by David Anderson!

Differential Review: https://reviews.llvm.org/D116065
2022-01-07 12:40:08 -08:00
Krzysztof Parzyszek d9ee9a1419 [Hexagon] Extract condition into function, NFC
Co-authored-by: Brian Cain <bcain@quicinc.com>
2022-01-07 12:35:12 -08:00
Julian Lettner 6f480655e6 [ASan][Darwin] Avoid crash during ASan initialization
Always pass `depth=1` to `vm_region_recurse_64()`.  `depth` is a in-out
parameter and gets reset to 0 after the first call, so we incorrectly
pass `depth=0` on subsequent calls.

We want to avoid the following crash:
```
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000180000000
Exception Codes: 0x0000000000000001, 0x0000000180000000
VM Region Info: 0x180000000 is not in any region. Bytes after previous region: 277577729 Bytes before following region: 384270336
   REGION TYPE         START - END   [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
   Stack          16f64c000-16f748000 [ 1008K] rw-/rwx SM=PRV thread 0
---> GAP OF 0x27730000 BYTES
   unused shlib __TEXT   196e78000-196eac000 [ 208K] r-x/r-x SM=COW ... this process
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [767]
```

Crashing code:
```
static mach_header *get_dyld_image_header() {
 unsigned depth = 1;
 vm_size_t size = 0;
 vm_address_t address = 0;
 kern_return_t err = KERN_SUCCESS;
 mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;

 while (true) {
  struct vm_region_submap_info_64 info;
  err = vm_region_recurse_64(mach_task_self(), &address, &size, &depth,
                (vm_region_info_t)&info, &count);
  if (err != KERN_SUCCESS) return nullptr;

  if (size >= sizeof(mach_header) && info.protection & kProtectionRead) {
   mach_header *hdr = (mach_header *)address;
   if ((hdr->magic == MH_MAGIC || hdr->magic == MH_MAGIC_64) &&   // << CRASH: sanitizer_procmaps_mac.cpp:176
     hdr->filetype == MH_DYLINKER) {
    return hdr;
   }
  }
  address += size;
 }
}
```

Radar-Id: rdar://problem/86773501

Differential Revision: https://reviews.llvm.org/D116240
2022-01-07 12:28:38 -08:00
Krzysztof Parzyszek dfbe74be63 [Hexagon] Fix release build break after 5476585673 2022-01-07 12:21:02 -08:00
John Ericson 44e3365775 [CMake] Factor out config prefix finding logic
See the docs in the new function for details.

 I think I found every instance of this copy pasted code. Polly could
 also use it, but currently does something different, so I will save the
 behavior change for a future revision.

We get the shared, non-installed CMake modules following the pattern
established in D116472.

It might be good to have LLD and Flang also use this, but that would be
a functional change and so I leave it as future work.

Reviewed By: beanz, lebedev.ri

Differential Revision: https://reviews.llvm.org/D116521
2022-01-07 20:16:18 +00:00
John Ericson b99833dc74 [cmake] Add read-me for the common CMake utils
Now that I am adding more things there, I thought it prudent to document
what should and should not go there, and how it is used.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D116524
2022-01-07 20:14:32 +00:00
Michael Lambert 028444c2b3 [Hexagon] Duplex error: wrong branch hint 2022-01-07 12:04:01 -08:00
colinl 4096ef3ed7 [Hexagon] Consider direction hint forming dealloc_return duplex 2022-01-07 12:04:00 -08:00