platform/upstream/llvm.git
3 years ago[InstCombine] fix comments to match code; NFC
Sanjay Patel [Fri, 29 Oct 2021 18:47:36 +0000 (14:47 -0400)]
[InstCombine] fix comments to match code; NFC

3 years ago[libc][NFC] Fix typo and unused variable
Guillaume Chatelet [Fri, 29 Oct 2021 19:42:51 +0000 (19:42 +0000)]
[libc][NFC] Fix typo and unused variable

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

3 years ago[lldb] [gdb-remote] Fix processing generic regnums
Michał Górny [Fri, 29 Oct 2021 18:46:32 +0000 (20:46 +0200)]
[lldb] [gdb-remote] Fix processing generic regnums

Fix regression in processing generic regnums that was introduced
in fa456505b80b0cf83647a1b26713e4d3b38eccc2 ("[lldb] [gdb-remote]
Refactor getting remote regs to use local vector").  Since then,
the "generic" field was wrongly interpreted as integer rather than
string constant.

Thanks to Ted Woodward for noticing and providing the correct code.

3 years ago[InlineAdvisor] Add fallback/format switches and negative remark processing to Replay...
modimo [Fri, 29 Oct 2021 19:09:28 +0000 (12:09 -0700)]
[InlineAdvisor] Add fallback/format switches and negative remark processing to Replay Inliner

Adds the following switches:

1. --sample-profile-inline-replay-fallback/--cgscc-inline-replay-fallback: controls what the replay advisor does for inline sites that are not present in the replay. Options are:

 1. Original: defers to original advisor
 2. AlwaysInline: inline all sites not in replay
 3. NeverInline: inline no sites not in replay

2. --sample-profile-inline-replay-format/--cgscc-inline-replay-format: controls what format should be generated to match against the replay remarks. Options are:

  1. Line
  2. LineColumn
  3. LineDiscriminator
  4. LineColumnDiscriminator

Adds support for negative inlining decisions. These are denoted by "will not be inlined into" as compared to the positive "inlined into" in the remarks.

All of these together with the previous `--sample-profile-inline-replay-scope/--cgscc-inline-replay-scope` allow tweaking in how to apply replay. In my testing, I'm using:
1. --sample-profile-inline-replay-scope/--cgscc-inline-replay-scope = Function to only replay on a function
2. --sample-profile-inline-replay-fallback/--cgscc-inline-replay-fallback = NeverInline since I'm feeding in only positive remarks to the replay system
3. --sample-profile-inline-replay-format/--cgscc-inline-replay-format = Line since I'm generating the remarks from DWARF information from GCC which can conflict quite heavily in column number compared to Clang

An alternative configuration could be to do Function, AlwaysInline, Line fallback with negative remarks which closer matches the final call-sites. Note that this can lead to unbounded inlining if a negative remark doesn't match/exist for one reason or another.

Updated various tests to cover the new switches and negative remarks

Testing:
ninja check-all

Reviewed By: wenlei, mtrofin

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

3 years agoSupport: Use sys::path::is_style_{posix,windows}() in a few places
Duncan P. N. Exon Smith [Fri, 22 Oct 2021 01:33:24 +0000 (18:33 -0700)]
Support: Use sys::path::is_style_{posix,windows}() in a few places

Use the new sys::path::is_style_posix() and is_style_windows() in a few
places that need to detect the system's native path style.

In llvm/lib/Support/Path.cpp, this patch removes most uses of the
private `real_style()`, where is_style_posix() and is_style_windows()
are just a little tidier.

Elsewhere, this removes `_WIN32` macro checks. Added a FIXME to a
FileManagerTest that seemed fishy, but maintained the existing
behaviour.

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

3 years ago[SampleProfile] Add all callsites to AllCandidates if InlineReplay is in effect
modimo [Wed, 27 Oct 2021 22:59:35 +0000 (15:59 -0700)]
[SampleProfile] Add all callsites to AllCandidates if InlineReplay is in effect

Replay in sample profiling needs to be asked on candidates that may not have counts or below the threshold. If replay is in effect for a function make sure these are captured and also imported during thinLTO.

Testing:
ninja check-all

Reviewed By: wenlei

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

3 years ago[NFC][LoopDeletion] Count the number of broken backedges
Roman Lebedev [Fri, 29 Oct 2021 18:58:02 +0000 (21:58 +0300)]
[NFC][LoopDeletion] Count the number of broken backedges

Those don't contribute to the number of deleted loops.

3 years ago[OpenMP][Docs] Add documentation for device RTL debugging
Joseph Huber [Mon, 18 Oct 2021 16:02:59 +0000 (12:02 -0400)]
[OpenMP][Docs] Add documentation for device RTL debugging

Add documentation for the debugging features in the OpenMP device
runtime library.

Reviewed By: tianshilei1992

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

3 years ago[OpenMP] Check output of malloc in the device for debug
Joseph Huber [Mon, 18 Oct 2021 15:41:43 +0000 (11:41 -0400)]
[OpenMP] Check output of malloc in the device for debug

A common problem is the device running out of global heap memory and
crashing due to a nullptr dereference when using the data sharing stack.
This explicitly checks that a nullptr was not returned by malloc when
debugging field 1 is enabled.

Reviewed By: jdoerfert

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

3 years ago[OpenMP] Use function tracing RAII for runtime functions.
Joseph Huber [Mon, 18 Oct 2021 15:14:07 +0000 (11:14 -0400)]
[OpenMP] Use function tracing RAII for runtime functions.

This patch adds support for using function tracing features to track the
executino of runtime functions in the device runtime library. This is
enabled by first compiling the new runtime with
`-fopenmp-target-debug=3` and running with
`LIBOMPTARGET_DEVICE_RTL_DEBUG=3`. The output only tracks team 0 and
thread 0 so there isn't much output when using a generic region.

Reviewed By: jdoerfert

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

3 years ago[AArch64][GlobalISel] Fix an crash in RBS due to a new regclass being added.
Amara Emerson [Fri, 29 Oct 2021 18:34:53 +0000 (11:34 -0700)]
[AArch64][GlobalISel] Fix an crash in RBS due to a new regclass being added.

rdar://84674985

3 years agoSupport: Expose sys::path::is_style_{posix,windows,native}()
Duncan P. N. Exon Smith [Thu, 16 Sep 2021 00:48:57 +0000 (20:48 -0400)]
Support: Expose sys::path::is_style_{posix,windows,native}()

Expose three helpers in namespace llvm::sys::path to detect the
path rules followed by sys::path::Style.

- is_style_posix()
- is_style_windows()
- is_style_native()

This are constexpr functions that that will allow a bunch of
path-related code to stop checking `_WIN32`.

Originally I looked at adding system_style(), analogous to
sys::endian::system_endianness(), but future patches (from others) will
add more Windows style variants for slash preferences. These helpers
should be resilient to that change, allowing callers to detect basic
path rules.

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

3 years ago[InstCombine] allow vector splat matching for bitwise logic folds
Sanjay Patel [Fri, 29 Oct 2021 18:21:36 +0000 (14:21 -0400)]
[InstCombine] allow vector splat matching for bitwise logic folds

These transforms are also likely missing a one-use check,
but that's another patch.

3 years ago[InstCombine] add tests for bitwise logic folds; NFC
Sanjay Patel [Fri, 29 Oct 2021 17:12:38 +0000 (13:12 -0400)]
[InstCombine] add tests for bitwise logic folds; NFC

3 years ago[NFC][PhaseOrdering] Add additional loop deletion tests
Roman Lebedev [Fri, 29 Oct 2021 18:09:22 +0000 (21:09 +0300)]
[NFC][PhaseOrdering] Add additional loop deletion tests

Test thanks to Michael Kuklinski from #llvm,
originally inspired by Daniel Lemire's https://lemire.me/blog/2021/10/26/in-c-is-empty-faster-than-comparing-the-size-with-zero/

3 years ago[flang] Fix combined folding of FINDLOC/MAXLOC/MINLOC
peter klausler [Wed, 27 Oct 2021 18:45:11 +0000 (11:45 -0700)]
[flang] Fix combined folding of FINDLOC/MAXLOC/MINLOC

The tests for folding these intrinsics neglected to name the
logical scalars with a leading "test_", so test failures caused
by recent work to implement a combined constant folding facility
for these intrinsics wasn't catching some bugs.  This patch fixes
the tests and the bugs.

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

3 years ago[InstCombine] Fold `(~(a | b) & c) | ~(a | c)` into `~((b & c) | a)`
Stanislav Mekhanoshin [Fri, 22 Oct 2021 19:07:42 +0000 (12:07 -0700)]
[InstCombine] Fold `(~(a | b) & c) | ~(a | c)` into `~((b & c) | a)`

```
----------------------------------------
define i4 @src(i4 %a, i4 %b, i4 %c) {
  %or1 = or i4 %b, %a
  %not1 = xor i4 %or1, -1
  %or2 = or i4 %a, %c
  %not2 = xor i4 %or2, -1
  %and = and i4 %not2, %b
  %or3 = or i4 %and, %not1
  ret i4 %or3
}

define i4 @tgt(i4 %a, i4 %b, i4 %c) {
  %and = and i4 %c, %b
  %or = or i4 %and, %a
  %or3 = xor i4 %or, -1
  ret i4 %or3
}
Transformation seems to be correct!
```

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

3 years ago[flang] Fix crash on "call system_clock(count_max=j)"
peter klausler [Mon, 25 Oct 2021 22:05:39 +0000 (15:05 -0700)]
[flang] Fix crash on "call system_clock(count_max=j)"

An erroneous entry in the intrinsics table causes semantics to
crash on a call to system_clock if the optional "count_max="
argument appears and "count=" does not.

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

3 years ago[libc] add fast path to string to float conversion
Michael Jones [Tue, 26 Oct 2021 23:39:23 +0000 (16:39 -0700)]
[libc] add fast path to string to float conversion

Add the fast path first described by Clinger [1] with additions by Gay [2].
This speeds up conversion by about 10% by handling numbers with fewer digits
more efficiently.

[1] Clinger WD. How to Read Floating Point Numbers Accurately.
SIGPLAN Not 1990 Jun;25(6):92–101. https://doi.org/10.1145/93548.93557.
[2] Gay DM, Correctly rounded binary-decimal and decimal-binary conversions;
1990. AT&T Bell Laboratories Numerical Analysis Manuscript 90-10.

Reviewed By: sivachandra

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

3 years ago[lld][WebAssembly] Handle TLS variables in Symbol::getVA. NFC
Sam Clegg [Fri, 29 Oct 2021 16:13:40 +0000 (09:13 -0700)]
[lld][WebAssembly] Handle TLS variables in Symbol::getVA. NFC

In the shared memory case we can always assume that TLS addresses
are relative to __tls_base.  In the non-shared memory case TLS
variables are absolute, just like normal data addresses.

This simplifies the code in calcNewValue so that TLS relocations
no longer need special handling.

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

3 years ago[X86] Don't affect jump tables under +tagged-globals.
Matt Morehouse [Fri, 29 Oct 2021 17:37:34 +0000 (10:37 -0700)]
[X86] Don't affect jump tables under +tagged-globals.

`classifyLocalReference(nullptr)` is called to get the appropriate
relocation type for jump tables.  We should not use @GOTPCREL for this
case.

The new test cases trigger assertions without this patch.

Reviewed By: eugenis

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

3 years ago[llvm-profgen] Update total samples by accumulating all its body samples
wlei [Wed, 27 Oct 2021 07:25:50 +0000 (00:25 -0700)]
[llvm-profgen] Update total samples by accumulating all its body samples

Like probe-based profile, the total samples is the sum of all its body samples. This patch fix it by a post-processing update for the line-number based profile. Tested it on our internal services, results showed no performance change.

Reviewed By: hoy, wenlei

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

3 years ago[SelectionDAG] Allow FindMemType to fail when widening loads & stores
Fraser Cormack [Mon, 18 Oct 2021 14:16:56 +0000 (15:16 +0100)]
[SelectionDAG] Allow FindMemType to fail when widening loads & stores

This patch removes an internal failure found in FindMemType and "bubbles
it up" to the users of that method: GenWidenVectorLoads and
GenWidenVectorStores. FindMemType -- renamed findMemType -- now returns
an optional value, returning None if no such type is found.

Each of the aforementioned users now pre-calculates the list of types it
will use to widen the memory access. If the type breakdown is not
possible they will signal a failure, at which point the compiler will
crash as it does currently.

This patch is preparing the ground for alternative legalization
strategies for vector loads and stores, such as using vector-predication
versions of loads or stores.

Reviewed By: RKSimon

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

3 years ago[llvm-profgen] Fix a set-but-unused warning
Kazu Hirata [Fri, 29 Oct 2021 17:19:44 +0000 (10:19 -0700)]
[llvm-profgen] Fix a set-but-unused warning

This patch fixes:

  llvm/tools/llvm-profgen/ProfiledBinary.cpp:357:12: error: variable
  'EndOffset' set but not used [-Werror,-Wunused-but-set-variable]

The last use of the variable was removed on Oct 26 in commit
40ca4112515d03bbcf594bd2dfa6b4394d5b00d6.

3 years ago[clang] Inclusive language: change error message to use allowlist
Zarko Todorovski [Fri, 29 Oct 2021 17:12:34 +0000 (13:12 -0400)]
[clang] Inclusive language: change error message to use allowlist

Reviewed By: vitalybuka

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

3 years ago[clang][driver] Fix multiarch output name with -Wl arg
Keith Smiley [Thu, 28 Oct 2021 22:55:54 +0000 (15:55 -0700)]
[clang][driver] Fix multiarch output name with -Wl arg

Previously if you passed a `-Wl,-foo` _before_ the source filename, the
first `InputInfos`, which is used for the base input name would be an
`InputArg` kind, which would never have a base input name. Now we use
that by default, but pick the first `InputInfo` that is of kind
`Filename` to get the name from if there is one.

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

3 years ago[llvm-reduce] optimize extractFromModule functions
Dwight Guth [Fri, 29 Oct 2021 17:06:04 +0000 (10:06 -0700)]
[llvm-reduce] optimize extractFromModule functions

The extractBasicBlocksFromModule, extractInstrFromModule, and other
similar functions previously performed very poorly when the number of
such elements in the program to reduce was very high. Previously, we
were creating the set which caches elements to keep by looping through
all elements in the module and adding them to the set. However, since
std::set is an ordered set, this introduces a massive amount of
rebalancing if the order of elements in the program and the order of
their pointers in memory are not the same.

The solution is straightforward: first put all the elements to be kept
in a vector, then use the constructor for std::set which takes a pair of
iterators over a collection. This constructor is optimized to avoid
doing unnecessary work when initializing large sets.

Also in this change, we pass BBsToKeep set to functions
replaceBranchTerminator and removeUninterestingBBsFromSwitch as a const
reference rather than passing it by value. This ought to prevent the
need to copy the collection each time these functions are called, which
is expensive if the collection is large.

Reviewed By: aeubanks

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

3 years ago[BasicAA] Add missing inbounds to tests (NFC)
Nikita Popov [Fri, 29 Oct 2021 16:59:46 +0000 (18:59 +0200)]
[BasicAA] Add missing inbounds to tests (NFC)

Add missing inbounds to tests that are not correct without it due
to possibility of offset overflow.

inbounds: https://alive2.llvm.org/ce/z/LC8G9_
w/o inbounds: https://alive2.llvm.org/ce/z/ErrJVW

3 years ago[llvm-profgen] Fix bug of populating profile symbol list
wlei [Fri, 22 Oct 2021 03:56:06 +0000 (20:56 -0700)]
[llvm-profgen] Fix bug of populating profile symbol list

Previous implementation of populating profile symbol list is wrong, it only included the profiled symbols. Actually it should use all symbols, here this switches to use the symbols from debug info. Also turned the flag off by default.

Reviewed By: wenlei, hoy

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

3 years ago[llvm-profgen] Switch to DWARF-based symbol and ranges
wlei [Tue, 26 Oct 2021 21:55:33 +0000 (14:55 -0700)]
[llvm-profgen] Switch to DWARF-based symbol and ranges

It happened a bug that some callsite name in the profile is not a real function, it turned out that there're some non-function symbol from the ELF text section, e.g. the global accessible branch label and also recalled that we can have one function being split into multiple ranges. We shouldn't count samples for those are not the entry of the real function.

So this change tried to fix this issue by switching to use the name or ranges from DWARF-based debug info, the range of which assure it's the real function start. For the split functions, we assume that the real entry function's DWARF name should always match the symbol table name.

The switching is also consistent with the body samples' symbol which is from DWARF.

Reviewed By: hoy, wenlei

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

3 years ago[RISCV] Teach RISCVInsertVSETVLI::needVSETVLI to handle mask register instructions...
Craig Topper [Thu, 28 Oct 2021 22:09:09 +0000 (15:09 -0700)]
[RISCV] Teach RISCVInsertVSETVLI::needVSETVLI to handle mask register instructions better.

If the VL operand of a mask register instruction comes from an
explicit vsetvli with a different VTYPE, we can still avoid needing
a vsetvli as long as the SEW/LMUL ratio is the same and policy bits
match.

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

3 years ago[analyzer] Retrieve a character from StringLiteral as an initializer for constant...
Denys Petrov [Wed, 20 Oct 2021 08:59:04 +0000 (11:59 +0300)]
[analyzer] Retrieve a character from StringLiteral as an initializer for constant arrays.

Summary: Assuming that values of constant arrays never change, we can retrieve values for specific position(index) right from the initializer, if presented. Retrieve a character code by index from StringLiteral which is an initializer of constant arrays in global scope.

This patch has a known issue of getting access to characters past the end of the literal. The declaration, in which the literal is used, is an implicit cast of kind `array-to-pointer`. The offset should be in literal length's bounds. This should be distinguished from the states in the Standard C++20 [dcl.init.string] 9.4.2.3. Example:
  const char arr[42] = "123";
  char c = arr[41]; // OK
  const char * const str = "123";
  char c = str[41]; // NOK

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

3 years agoFixed erring semantic errors arising from D108904
Nimish Mishra [Fri, 29 Oct 2021 22:09:09 +0000 (03:39 +0530)]
Fixed erring semantic errors arising from D108904

3 years agoAMDGPU: Check kernarg alignments in test
Matt Arsenault [Thu, 28 Oct 2021 00:33:14 +0000 (20:33 -0400)]
AMDGPU: Check kernarg alignments in test

Strangely the kernel code object header clamps the value to a minimum
of 16, but the emitted metadata only clamps to a minimum of 4.

3 years ago[CostModel][X86] Remove old TODO comment
Simon Pilgrim [Fri, 29 Oct 2021 16:28:29 +0000 (17:28 +0100)]
[CostModel][X86] Remove old TODO comment

BMI (TZCNT) scalar handling was added at rGa2db388dce77c2f23f2009d7363a0b63bb54523c

3 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Fri, 29 Oct 2021 16:21:57 +0000 (12:21 -0400)]
[InstCombine] regenerate test checks; NFC

3 years ago[OpenMP] Add triple to run lines to avoid message differences
Mike Rice [Fri, 29 Oct 2021 16:13:31 +0000 (09:13 -0700)]
[OpenMP] Add triple to run lines to avoid message differences

Diagnostics with function types can show calling conventions on some platforms.
Just choose one to prevent that.

3 years ago[llvm-reduce] Actually skip invalid candidates in operands-to-args
Arthur Eubanks [Thu, 28 Oct 2021 22:50:34 +0000 (15:50 -0700)]
[llvm-reduce] Actually skip invalid candidates in operands-to-args

This was checked while counting but not actually when doing the reduction, resulting in crashes.

Reviewed By: Meinersbur

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

3 years ago[libc++] Mark LWG3211 as complete: default constructor of tuple<> should be trivial
Joe Loser [Fri, 29 Oct 2021 16:07:35 +0000 (12:07 -0400)]
[libc++] Mark LWG3211 as complete: default constructor of tuple<> should be trivial

`libc++` has had the guarantee of the default constructor of `tuple<>` being
trivial since 405570dc7a95cdf43cdee14b8a9f9c1657a6ad13. Now, the
standard mandates it as of LWG3211. So, move the file out of
`libcxx/test/libcxx` and into `libcxx/test/std` since it's no longer
`libc++`-specific. Rename it to be `.compile.pass.cpp` instead of
`.pass.cpp` while we're at it.

Reviewed By: ldionne, Quuxplusone, Mordante, #libc

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

3 years agoDon't drop in_bounds when vector-transfer-collapse-inner-most-dims
Ahmed Taei [Fri, 29 Oct 2021 00:37:35 +0000 (17:37 -0700)]
Don't drop in_bounds when vector-transfer-collapse-inner-most-dims

When operand is a subview we don't infer in_bounds and some default cases (e.g case in the tests) will crash with `operand is NULL` when converting to LLVM

Reviewed By: ThomasRaoux

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

3 years ago[BasicAA] Add range test with nsw (NFC)
Nikita Popov [Thu, 28 Oct 2021 21:00:20 +0000 (23:00 +0200)]
[BasicAA] Add range test with nsw (NFC)

3 years agoPoint replay file to non-existent dummy
Steven Wan [Fri, 29 Oct 2021 15:56:44 +0000 (11:56 -0400)]
Point replay file to non-existent dummy

Operating systems such as AIX allow open and read on directories, passing in a direcotry as the replay file triggers `Invalid remark format` instead of `Could not open remarks file: Is a directory`. This patch substitutes the directory with a non-existent filename. The current filecheck should still work as-is.

Reviewed By: modimo, Whitney

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

3 years ago[clangd] IncludeCleaner: Skip non self-contained headers
Kirill Bobyrev [Fri, 29 Oct 2021 15:57:29 +0000 (17:57 +0200)]
[clangd] IncludeCleaner: Skip non self-contained headers

Headers without include guards might have side effects or can be the files we
don't want to consider (e.g. tablegen ".inc" files). Skip them when translating
headers to the HeaderIDs that we will consider as unused.

Reviewed By: sammccall

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

3 years ago[libc][NFC] Move test related pieces from FPUtil to util/UnitTest.
Siva Chandra Reddy [Wed, 27 Oct 2021 21:07:35 +0000 (21:07 +0000)]
[libc][NFC] Move test related pieces from FPUtil to util/UnitTest.

Reviewed By: michaelrj

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

3 years agotsan: add debugging code for ptrace test failures
Dmitry Vyukov [Thu, 28 Oct 2021 11:00:09 +0000 (13:00 +0200)]
tsan: add debugging code for ptrace test failures

Debugging of crashes on powerpc after commit:
c80604f7a3 ("tsan: remove real func check from interceptors")
Somehow replacing if with DCHECK leads to strange failures in:
SanitizerCommon-tsan-powerpc64le-Linux :: Linux/ptrace.cpp
https://lab.llvm.org/buildbot/#/builders/105
https://lab.llvm.org/buildbot/#/builders/121
https://lab.llvm.org/buildbot/#/builders/57

The hypothesis is that something writes out-of-bounds
into pt_regs on stack and that corrupts internal tsan state.

Reviewed By: melver

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

3 years ago[NFC] ProfileSummary: const most of the fields.
Mircea Trofin [Fri, 29 Oct 2021 15:23:51 +0000 (08:23 -0700)]
[NFC] ProfileSummary: const most of the fields.

This simplifies readability / maintainability.

3 years ago[mlir][linalg] Add padding pass to strategy passes.
Tobias Gysi [Fri, 29 Oct 2021 15:14:45 +0000 (15:14 +0000)]
[mlir][linalg] Add padding pass to strategy passes.

Add a strategy pass that pads and hoists after tiling and fusion.

Depends On D112412

Reviewed By: nicolasvasilache

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

3 years ago[docs] Inclusive language: replace master with main
Quinn Pham [Wed, 27 Oct 2021 15:23:14 +0000 (10:23 -0500)]
[docs] Inclusive language: replace master with main

[NFC] As part of using inclusive language within the llvm
project and be consistent with the renamed branch,
replace master with main.

Reviewed By: mehdi_amini

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

3 years ago[mlir][linalg] Add pad and hoist test pass.
Tobias Gysi [Fri, 29 Oct 2021 14:44:43 +0000 (14:44 +0000)]
[mlir][linalg] Add pad and hoist test pass.

Adding a padding and hoisting pattern, a test pass, and tests. The patch prepares the split of tiling/fusion and padding.

Depends On D112255

Reviewed By: nicolasvasilache

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

3 years ago[lld-macho] -all_load and -ObjC should not affect LC_LINKER_OPTION flags
Jez Ng [Fri, 29 Oct 2021 15:00:16 +0000 (11:00 -0400)]
[lld-macho] -all_load and -ObjC should not affect LC_LINKER_OPTION flags

In particular, they should not cause archives to be eagerly loaded. This
matches ld64's behavior.

Fixes PR52246.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho][nfc] Canonicalize all pointers to InputSections early on
Jez Ng [Fri, 29 Oct 2021 15:00:13 +0000 (11:00 -0400)]
[lld-macho][nfc] Canonicalize all pointers to InputSections early on

Having to remember to call `canonical()` all over the place is
error-prone; let's do it in a centralized location instead. It also
appears to improve performance slightly.

             base           diff           difference (95% CI)
  sys_time   0.984 ± 0.009  0.983 ± 0.014  [  -0.8% ..   +0.6%]
  user_time  6.508 ± 0.035  6.475 ± 0.036  [  -0.8% ..   -0.2%]
  wall_time  5.321 ± 0.034  5.300 ± 0.033  [  -0.7% ..   -0.1%]
  samples    36             23

Reviewed By: #lld-macho, thakis

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

3 years ago[AArch64][SVE] Use TargetFrameIndex in more SVE load/store addressing modes
Bradley Smith [Tue, 26 Oct 2021 14:53:53 +0000 (14:53 +0000)]
[AArch64][SVE] Use TargetFrameIndex in more SVE load/store addressing modes

Add support for generating TargetFrameIndex in complex patterns for
indexed addressing modes in SVE. Additionally, add missing load/stores
to getMemOpInfo and getLoadStoreImmIdx.

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

3 years agosanitizer_common: fix ParseUnixMemoryProfile test linking on Mac
Dmitry Vyukov [Fri, 29 Oct 2021 13:50:39 +0000 (15:50 +0200)]
sanitizer_common: fix ParseUnixMemoryProfile test linking on Mac

The ParseUnixMemoryProfile function is defined only for a subset
of platforms. Define the test for the same set of platforms.

Also disable the test for 32-bit platforms b/c the pointer
values used in the test are 64-bit and don't fit into 32-bit uptr.

Reported-by: Jan Svoboda (jansvoboda11)
Reviewed By: melver

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

3 years ago[IR] Remove createReplacementInstr. NFC.
Jay Foad [Fri, 29 Oct 2021 09:48:27 +0000 (10:48 +0100)]
[IR] Remove createReplacementInstr. NFC.

It is unused since D112791.

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

3 years ago[IR] Merge createReplacementInstr into ConstantExpr::getAsInstruction
Jay Foad [Fri, 29 Oct 2021 09:08:47 +0000 (10:08 +0100)]
[IR] Merge createReplacementInstr into ConstantExpr::getAsInstruction

createReplacementInstr was a trivial wrapper around
ConstantExpr::getAsInstruction, which also inserted the new instruction
into a basic block. Implement this directly in getAsInstruction by
adding an InsertBefore parameter and change all callers to use it. NFC.

A follow-up patch will remove createReplacementInstr.

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

3 years ago[AMDGPU] Change numBitsSigned for simplicity and document it. NFC.
Jay Foad [Fri, 29 Oct 2021 12:54:35 +0000 (13:54 +0100)]
[AMDGPU] Change numBitsSigned for simplicity and document it. NFC.

Change numBitsSigned to return the minimum size of a signed integer that
can hold the value. This is different by one from the previous result
but is more consistent with numBitsUnsigned. Update all callers. All
callers are now more consistent between the signed and unsigned cases,
and some callers get simpler, especially the ones that deal with
quantities like numBitsSigned(LHS) + numBitsSigned(RHS).

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

3 years ago[mlir][python] Add a __contains__ method to the python bindings for DictionaryAttr.
Adrian Kuegel [Fri, 29 Oct 2021 13:11:09 +0000 (15:11 +0200)]
[mlir][python] Add a __contains__ method to the python bindings for DictionaryAttr.

This makes it easier to check in python whether a certain attribute is there.

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

3 years ago[lldb/test] Fix TestSourceManager for eee887e0
Pavel Labath [Fri, 29 Oct 2021 12:54:42 +0000 (14:54 +0200)]
[lldb/test] Fix TestSourceManager for eee887e0

I'm removing the extra trace commands as they're not compatible with
windows, and there's no immediate replacement available.

3 years agoOfficially deprecate LLVM_ENABLE_PROJECTS for libc++, libc++abi and libunwind
Louis Dionne [Thu, 28 Oct 2021 14:42:51 +0000 (10:42 -0400)]
Officially deprecate LLVM_ENABLE_PROJECTS for libc++, libc++abi and libunwind

This updates the LLVM wide documentation for building LLVM and the runtimes
and adds a CMake warning when folks specify libcxx, libcxxabi or libunwind
in LLVM_ENABLE_PROJECTS, pointing them to the updated instructions for
building the runtimes.

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

3 years ago[lldb/test] Fix TestFunctionStarts for eee887e0
Pavel Labath [Fri, 29 Oct 2021 12:42:54 +0000 (14:42 +0200)]
[lldb/test] Fix TestFunctionStarts for eee887e0

3 years ago[sanitizer_common] Fix Posix/mmap_write_exec.cpp on 32-bit Solaris
Rainer Orth [Fri, 29 Oct 2021 12:29:41 +0000 (14:29 +0200)]
[sanitizer_common] Fix Posix/mmap_write_exec.cpp on 32-bit Solaris

The new `Posix/mmap_write_exec.cpp` test FAILs on 32-bit Solaris/x86.  This
happens because only `mmap` is intercepted, but not `mmap64` which is used
for largefile support.

Fixed by also intercepting `mmap64`.

Tested on `amd64-pc-solaris2.11`.

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

3 years ago[mlir][NFC] Fix leak in unit test
Vladislav Vinogradov [Fri, 29 Oct 2021 12:24:46 +0000 (15:24 +0300)]
[mlir][NFC] Fix leak in unit test

Destroy operation created in
`OperationFormatPrintTest.CanUseVariadicFormat` test.

3 years ago[PowerPC] fix a miscompile for Solaris build
Chen Zheng [Fri, 29 Oct 2021 12:04:54 +0000 (12:04 +0000)]
[PowerPC] fix a miscompile for Solaris build

3 years agosanitizer_common: bump default file max size to 256MB
Dmitry Vyukov [Fri, 29 Oct 2021 09:40:11 +0000 (11:40 +0200)]
sanitizer_common: bump default file max size to 256MB

I am hitting some cases where /proc/self/maps does not fit into 64MB.
256MB is lots of memory, but it's not radically more than the current 64MB.
Ideally we should read/parse these huge files incrementally,
but that's lots of work for a debugging/introspection interface.
So for now just bump the limit.

Depends on D112793.

Reviewed By: melver

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

3 years agosanitizer_common: fix crashes in parsing of memory profiles
Dmitry Vyukov [Fri, 29 Oct 2021 09:26:04 +0000 (11:26 +0200)]
sanitizer_common: fix crashes in parsing of memory profiles

ParseUnixMemoryProfile assumes well-formed input with \n at the end, etc.
It can over-read the input and crash on basically every line
in the case of malformed input.
ReadFileToBuffer has cap the max file size (64MB) and returns
truncated contents if the file is larger. Thus even if kernel behaves,
ParseUnixMemoryProfile crashes on too large /proc/self/smaps.
Fix input over-reading in ParseUnixMemoryProfile.

Depends on D112792.

Reviewed By: melver

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

3 years agosanitizer_common: add memory profile parsing test
Dmitry Vyukov [Fri, 29 Oct 2021 08:45:52 +0000 (10:45 +0200)]
sanitizer_common: add memory profile parsing test

Depends on D112790.

Reviewed By: melver

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

3 years ago[AArch64][SVE] Fix build failure introduced in 13faa5f44015e111e938f301d40478d965567a5d
Bradley Smith [Fri, 29 Oct 2021 11:56:35 +0000 (11:56 +0000)]
[AArch64][SVE] Fix build failure introduced in 13faa5f44015e111e938f301d40478d965567a5d

3 years agosanitizer_common: remove unnecessary GetMemoryProfile arg
Dmitry Vyukov [Fri, 29 Oct 2021 08:31:37 +0000 (10:31 +0200)]
sanitizer_common: remove unnecessary GetMemoryProfile arg

stats_size argument is unnecessary in GetMemoryProfile and in the callback.
It just clutters code. The callback knowns how many stats to expect.

Depends on D112789.

Reviewed By: melver

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

3 years agosanitizer_common: make parsing of smaps testable (NFC)
Dmitry Vyukov [Fri, 29 Oct 2021 08:23:41 +0000 (10:23 +0200)]
sanitizer_common: make parsing of smaps testable (NFC)

Move parsing of /proc/self/smaps into a separate function
so that it can be tested.

Depends on D112788.

Reviewed By: melver

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

3 years agosanitizer_common: fix up onprint.cpp test more
Dmitry Vyukov [Fri, 29 Oct 2021 08:17:18 +0000 (10:17 +0200)]
sanitizer_common: fix up onprint.cpp test more

D112630 ("sanitizer_common: fix up onprint.cpp test")
added O_CREAT, but we also need O_TRUNC b/c the file
may not exist, or may exist as well.

Reviewed By: melver

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

3 years ago[lldb/test] Replace shlex.join with shlex.quote
Pavel Labath [Fri, 29 Oct 2021 11:33:56 +0000 (13:33 +0200)]
[lldb/test] Replace shlex.join with shlex.quote

join is only available since python-3.8, but the all the interesting
magic happens in shlex.quote, which has been around since 3.3.

Use shlex.quote, and instead provide a home-grown helper function to
handle the joining.

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

3 years ago[InstCombine] Fold BW/2+1 tops bits are same pattern
David Green [Fri, 29 Oct 2021 11:30:20 +0000 (12:30 +0100)]
[InstCombine] Fold BW/2+1 tops bits are same pattern

Match "icmp eq (trunc (lsr A, BW), (ashr (trunc A), BW-1))", which checks
the top BW/2 + 1 bits are all the same. Create "A >=s INT_MIN && A <=s
INT_MAX", which we generate as "icmp ult (add A, 2^BW-1), 2^BW" to skip
a few steps of instcombining.
https://alive2.llvm.org/ce/z/NjH6Ty
https://alive2.llvm.org/ce/z/_fEQ9P

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

3 years ago[mlir] MathApproximations: scalars shape must be 0-rank
Eugene Zhulenev [Thu, 28 Oct 2021 22:34:11 +0000 (15:34 -0700)]
[mlir] MathApproximations: scalars shape must be 0-rank

Using [1] for representing shape of a scalar is incorrect, and will break with vectors of size 1.

- remove redundant helper functions
- fix couple of style warnings

Reviewed By: cota

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

3 years ago[clangd] Track performance of IncludeCleaner
Kirill Bobyrev [Fri, 29 Oct 2021 10:59:17 +0000 (12:59 +0200)]
[clangd] Track performance of IncludeCleaner

Reviewed By: kadircet

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

3 years ago[X86] combineX86GatherScatter - only fold scale if the index isn't extended
Simon Pilgrim [Fri, 29 Oct 2021 10:47:38 +0000 (11:47 +0100)]
[X86] combineX86GatherScatter - only fold scale if the index isn't extended

As mentioned on D108539, when the gather indices are smaller than the pointer size, they are sign-extended BEFORE scale is applied, making the general fold unsafe.

If the index have sufficient sign-bits then folding the scale could be safe - I'll investigate this.

3 years ago[ASTImporter] Remove redundant IsStructuralMatch overloads
Raphael Isemann [Fri, 29 Oct 2021 10:17:11 +0000 (12:17 +0200)]
[ASTImporter] Remove redundant IsStructuralMatch overloads

Nearly all of the overloads have pretty much the same behaviour. The only
exception here is that some of them call back `GetOriginalDecl` and others
don't, but the only real user of that overload (which is LLDB) actually prefers
getting this callback.

Reviewed By: martong

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

3 years ago[GVN] Add tests showing generation of already existent PHIs for non-local loads
Dmitry Makogon [Fri, 29 Oct 2021 09:25:53 +0000 (16:25 +0700)]
[GVN] Add tests showing generation of already existent PHIs for non-local loads

When we eliminate a non-local load in a loop, we create a new PHI for the loaded value,
while there already may be the exact same PHIs in the loop.

IndVarsSimplify currently can handle this case eliminating the duplicated PHIs.

However, if the loop PHI is of type of the load and also there exists
an use of the z(s)ext'ed of it, IndVarSimplify wouldn't eliminate the duplicating PHI.
It would just replace the IV with a widened one, leaving the GVN-generated PHI as is.

3 years ago[InstCombine] Convert xor (ashr X, BW-1), C -> select(X >=s 0, C, ~C)
David Green [Fri, 29 Oct 2021 10:19:20 +0000 (11:19 +0100)]
[InstCombine] Convert xor (ashr X, BW-1), C -> select(X >=s 0, C, ~C)

The sequence of instructions `xor (ashr X, BW-1), C` (or with a truncation
`xor (trunc (ashr X, BW-1)), C)` takes a value, produces all zeros or all
ones and with it optionally inverts a constant depending on whether the
original input was positive or negative. This is the same as checking if
the value is positive, and selecting between the constant and ~constant.
https://alive2.llvm.org/ce/z/NJ85qY

This is a fairly general version of a fold that helps pull saturating
arithmetic into a canonical form.

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

3 years ago[lldb] Remove ConstString from SymbolVendor, Trace, TraceExporter, UnwindAssembly...
Pavel Labath [Fri, 29 Oct 2021 09:40:54 +0000 (11:40 +0200)]
[lldb] Remove ConstString from SymbolVendor, Trace, TraceExporter, UnwindAssembly, MemoryHistory and InstrumentationRuntime plugin names

3 years ago[AArch64][SVE] Generate SVE >1 element structured load/stores from fixed types
Bradley Smith [Mon, 18 Oct 2021 12:29:26 +0000 (12:29 +0000)]
[AArch64][SVE] Generate SVE >1 element structured load/stores from fixed types

This adds support for SVE structured loads/stores to the relevant target
hooks, such that we can support these instructions in the InterleavedAccess
pass.

Depends on D112078

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

3 years ago[lldb/test] Print build commands in trace mode
Pavel Labath [Tue, 19 Oct 2021 11:49:31 +0000 (13:49 +0200)]
[lldb/test] Print build commands in trace mode

Running tests with -t prints all lldb commands being run. It makes sense
to print all the build commands as well.

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

3 years ago[lldb] Remove forgotten FIXME on CPlusPlus formatters
Luís Ferreira [Fri, 29 Oct 2021 09:30:35 +0000 (11:30 +0200)]
[lldb] Remove forgotten FIXME on CPlusPlus formatters

The patch [1] introduced this FIXME but ended up not being removed when fixed.

[1]: https://github.com/llvm/llvm-project/commit/f68df12fb039d5177e34f4541fa242b891949db6

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
Reviewed By: teemperor

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

3 years ago[lldb] Refactor C/C++ string and char summary providers
Luís Ferreira [Fri, 29 Oct 2021 09:16:02 +0000 (11:16 +0200)]
[lldb] Refactor C/C++ string and char summary providers

This patch refactors C/C++ formatters to avoid repetitive code by using templates.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D112658
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
3 years ago[Sparc] NFC: Remove unused tblgen template args
Cullen Rhodes [Fri, 29 Oct 2021 08:28:46 +0000 (08:28 +0000)]
[Sparc] NFC: Remove unused tblgen template args

Identified in D109359.

Reviewed By: sdesmalen

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

3 years ago[lldb] Make TypeSystemClang::GetFullyUnqualifiedType work for constant arrays
Pavel Labath [Thu, 28 Oct 2021 11:24:46 +0000 (13:24 +0200)]
[lldb] Make TypeSystemClang::GetFullyUnqualifiedType work for constant arrays

Unqualify (constant) arrays recursively, just like we do for pointers.
This allows for better pretty printer matching.

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

3 years ago[TailDuplicator] Fix merging block with terminator
Neubauer, Sebastian [Fri, 22 Oct 2021 12:06:04 +0000 (14:06 +0200)]
[TailDuplicator] Fix merging block with terminator

The TailDuplicator merged two blocks, even if the first one ended with
a terminator, resulting in invalid MIR, where a terminator is in the
middle of a block.

Abort merging if the first block ends with a terminator.

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

3 years ago[lldb] [Host/Terminal] Remove stale Config.h include from the header
Michał Górny [Fri, 29 Oct 2021 08:02:11 +0000 (10:02 +0200)]
[lldb] [Host/Terminal] Remove stale Config.h include from the header

3 years ago[lldb] [Host/Terminal] Fix warnings with termios disabled
Michał Górny [Thu, 28 Oct 2021 19:03:49 +0000 (21:03 +0200)]
[lldb] [Host/Terminal] Fix warnings with termios disabled

Thanks to Nico Weber for the suggestion.

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

3 years ago[mlir][docs] Fix obvious spelling mistakes in documentation
Markus Böck [Fri, 29 Oct 2021 07:19:11 +0000 (09:19 +0200)]
[mlir][docs] Fix obvious spelling mistakes in documentation

3 years ago[mlir][NFC] Fix typo in comment
Markus Böck [Fri, 29 Oct 2021 07:00:19 +0000 (09:00 +0200)]
[mlir][NFC] Fix typo in comment

3 years ago[mlir][NFC] Make InsertionGuard properly move constructible
Markus Böck [Fri, 29 Oct 2021 06:56:38 +0000 (08:56 +0200)]
[mlir][NFC] Make InsertionGuard properly move constructible

InsertionGuards move constructor is currently the compiler synthesized implementation which is very bug prone. A move constructed InsertionGuard will get the same builder and insertion point as the one it is constructed from, leading to insertion point being restored twice. This can even happen in non obvious situations on some compilers, such as when returning a move constructible struct from a function.

This patch fixes the issue by properly implementing the move constructor. An InsertionGuard that was used to move construct another InsertionGuard is simply inactive and will not restore the insertion point.

I chose to explicitly delete the move assign operator as its semantics are not clear cut. If one were to strictly follow the rule of 5, you'd have to restore the insertion point before then taking ownership of the others guards fields. I believe that to be rather confusing and/or surprising however. One may still get such semantics using llvm::Optional or std::optional and the emplace method if really needed.

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

3 years ago[mlir][linalg] Adapt hoistPaddingOnTensors signature to support patterns (NFC).
Tobias Gysi [Fri, 29 Oct 2021 06:42:32 +0000 (06:42 +0000)]
[mlir][linalg] Adapt hoistPaddingOnTensors signature to support patterns (NFC).

Adapt hoistPaddingOnTensors to leave replacing and erasing the old pad tensor operation to the caller. This change makes the function pattern friendly.

Depends On D112003

Reviewed By: nicolasvasilache

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

3 years ago[clang] Partially revert d8cd7806310c51af912a647a6ca46de62ff13214.
Brad Smith [Fri, 29 Oct 2021 06:34:38 +0000 (02:34 -0400)]
[clang] Partially revert d8cd7806310c51af912a647a6ca46de62ff13214.

The C11 atomics part was wrong.

3 years ago[clang-tidy]performance-unnecessary-copy-initialization: fix false negative
Clement Courbet [Thu, 28 Oct 2021 14:48:53 +0000 (16:48 +0200)]
[clang-tidy]performance-unnecessary-copy-initialization: fix false negative

We're missing all cases where the return value is a type alias.

Unfortunately, this includes things we care about, such as
`std::vector<T>::operator[]` (return value is `const_reference`,
not `const T&`).

Match the canonical type instead.

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

3 years ago[libcxx] [test] Change LIBCXX-WINDOWS-FIXME into XFAIL: msvc for cases that succeed...
Martin Storsjö [Mon, 17 May 2021 20:53:10 +0000 (20:53 +0000)]
[libcxx] [test] Change LIBCXX-WINDOWS-FIXME into XFAIL: msvc for cases that succeed in mingw configurations

Add comments about the reasons for the XFAILs where there was none before.

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

3 years ago[clang] [MinGW] Guess the right ix86 arch name spelling as sysroot
Martin Storsjö [Sat, 16 Oct 2021 14:30:28 +0000 (17:30 +0300)]
[clang] [MinGW] Guess the right ix86 arch name spelling as sysroot

For x86, most contempory mingw toolchains use i686 as 32 bit
x86 arch target.

As long as the target triple is set to the right form, this works
fine, either as the compiler's default target, or via e.g.
a triple prefix like i686-w64-mingw32-clang.

However, if the unprefixed toolchain targets x86_64, but the user
tries to switch it to target 32 bit by adding the -m32 option, the
computeTargetTriple function in Clang, together with
Triple::get32BitArchVariant, sets the arch to i386. This causes
the right sysroot to not be found.

When targeting an arch where there are potential spelling ambiguities
with respect to the sysroots (i386 and arm), check if the driver can
find a sysroot with the arch name - if not, try a couple other
candidates.

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

3 years ago[mlir][linalg] Use OpBuilder in rewriteAsPaddedOp (NFC).
Tobias Gysi [Thu, 28 Oct 2021 18:54:57 +0000 (18:54 +0000)]
[mlir][linalg] Use OpBuilder in rewriteAsPaddedOp (NFC).

Adapt the rewriteAsPaddedOp method to use the OpBuilder instead of the PatterRewriter.

Reviewed By: nicolasvasilache

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

3 years ago[llvm-objcopy] Fix misaligned access to load command data.
Daniel Rodríguez Troitiño [Thu, 28 Oct 2021 18:33:53 +0000 (11:33 -0700)]
[llvm-objcopy] Fix misaligned access to load command data.

It seems that llvm-objcopy stores data temporarily misaligned with the
requirements of the underlaying struct from libBinaryFormat, and UBSan
generates a runtime error.

Instead of trying to reinterpret the memory as the struct itself, simply
access the `char *` pointer that we are interested in, and that do not
have alignment restrictions.

This problem was pointed out in a comment of D111164.

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

3 years ago[lld-macho] Internalize createFiles. NFC
Fangrui Song [Fri, 29 Oct 2021 05:14:36 +0000 (22:14 -0700)]
[lld-macho] Internalize createFiles. NFC

3 years ago[AMDGPU] Fix cvt_f32_ubyte combine with shl
Vang Thao [Thu, 28 Oct 2021 16:55:54 +0000 (09:55 -0700)]
[AMDGPU] Fix cvt_f32_ubyte combine with shl

Shift node is still needed to check if the shift is shr or shl to increment/decrement offset. Do not override the node.

Reviewed By: arsenm

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