Commit Graph

437253 Commits

Author SHA1 Message Date
Fangrui Song 7787427605 [ELF] Avoid redundant assignment to Symbol fields. NFC 2022-09-28 17:56:16 -07:00
Florian Mayer e06c9b63bc [NFC] [HWASan] remove unnecessary cast 2022-09-28 17:48:19 -07:00
wanglei 7b1bdfbeb0 [LoongArch] Override TargetSubtargetInfo::getSelectionDAGInfo
The target selection DAG lowering information is needed for
SelectionDAGBuilder to lower a call like memcmp into an optimized
form.

Differential Revision: https://reviews.llvm.org/D134712
2022-09-29 08:46:53 +08:00
Jason Molenda 34f3e57680 Include <cmath> before using std::pow()
Not sure why this is failing for me to build tonight, but either
something in a header somewhere changed or my tools changed, and
it is failing to compile.
2022-09-28 17:35:35 -07:00
Nico Weber faaff2cdce [lldb] Fix deprecation warnings for hasValue and getValue in mac-only code paths
No behavior change.
2022-09-28 20:12:32 -04:00
Nico Weber dcb94010eb Revert "When there are variable errors, display an error in VS Code's local variables view."
This reverts commit 15f83ab775.
Doesn't build, see https://reviews.llvm.org/D134333#3822313
2022-09-28 20:07:14 -04:00
Aart Bik f231821e6e [mlir][sparse] provide convenience methods for toOrig/toStoredDim
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D134833
2022-09-28 16:32:03 -07:00
Vitaly Buka 01f3e2d619 [StackLifetime] More efficient loop for LivenessType::Must
CFG with cycles may requires additional passes of "while (Changed)"
iteration if to propagate data back from latter blocks to earlier blocks,
ordered according to depth_fist.

OR logic, used for ::May, converge to stable state faster then AND logic
use for ::Must.

Though the better solution is to switch to some some form of queue, but
having that this one is good enough, I will consider to do that later.

We can switch ::Must to OR logic if we calculate "may be dead" instead
of direct "must be alive" and then convert values to match existing
interface.

Additionally it fixes correctness in "@cycle" test.

Reviewed By: kstoimenov, fmayer

Differential Revision: https://reviews.llvm.org/D134796
2022-09-28 16:28:45 -07:00
Jessica Paquette 95dabac7a5 [AArch64][GlobalISel] Make G_PTRTOINT only legal for s64 + p0
A few issues:

  1. There was no legalizer test for G_PTRTOINT
  2. Same clamping issue as in many other opcodes
  3. AArch64 pointers can only be 64b, so in reality we always have to trunc or
     extend with any size other than p0 anyway.

This seems to actually produce more correct selection for narrow types as well.

Differential Revision: https://reviews.llvm.org/D107588
2022-09-28 16:20:24 -07:00
Philip Reames f49887f7fd [RISCV] Add test coverage for upcoming select lowering optimization
Test copied from X86 backend since I'm going to be taking the code from there too.
2022-09-28 16:04:25 -07:00
Jessica Paquette a7aaafde2e [AArch64][GlobalISel] Implement custom legalization for s32/s64 G_FCOPYSIGN
This is intended to be equivalent to the s32 + s64 cases in
AArch64TargetLowering::LowerFCOPYSIGN.

Widen everything and then use G_BIT + a mask to handle the actual copysign
operation. Then, narrow back down to s32/s64.

I wasn't sure about what the best/most canonical INSERT_SUBREG-selectable
pattern is. I chose G_INSERT_VECTOR_ELT + an undef vector because it produces
reasonably okay codegen. (It doesn't produce INSERT_SUBREG right now though.)
If there's a better way to do this then I'm happy to change it.

We also have a couple codegen deficiencies with how we emit vector constants
right now. (We need a GISel equivalent to the tryAdvSIMDModImm64 stuff)

Differential Revision: https://reviews.llvm.org/D108725
2022-09-28 16:03:22 -07:00
Rafael Auler ba9cc6537c [PERF2BOLT] Fix unittest failure
Fix failure caused by commit e549ac072b "Do not issue parsing error on
weird build ids".
2022-09-28 16:01:57 -07:00
Florian Mayer 0401dc2913 [MTE] [HWASan] unify isInterestingAlloca
Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D134779
2022-09-28 15:52:34 -07:00
Jessica Paquette 4957ee6529 [AArch64][GlobalISel] Add a target-specific G_BIT opcode.
This is necessary for custom-legalizing G_FCOPYSIGN.

This is equivalent to the BIT instruction (bitwise insert if true).

Add selection testcases for imported patterns.

Differential Revision: https://reviews.llvm.org/D108714
2022-09-28 15:48:35 -07:00
Jessica Paquette a4591a61df [llvm-remarkutil] Add an option to print out function sizes
This adds an `instruction-count` command to llvm-remarkutil.

```
llvm-remarkutil instruction-count --parser=<bitstream|yaml> <file>
```

This will, for now, only print out asm-printer `InstructionCount` remarks.

Frequently I need to find out things like "what are the top 10 largest
functions" in a given project.

This makes it so we can find that information quickly and easily from any
format of remarks.

I chose a CSV because I usually want to stick these into a spreadsheet, and
the data is two-dimensional.

In the future, we may want to change this to another format if we add more
complicated data.

Differential Revision: https://reviews.llvm.org/D134765
2022-09-28 15:45:55 -07:00
Jessica Paquette 704b2e162c [GlobalISel] Add isConstFalseVal helper to Utils
Add a utility function which returns true if the given value is a constant
false value.

This is necessary to port one of the compare simplifications in
TargetLowering::SimplifySetCC.

Differential Revision: https://reviews.llvm.org/D91754
2022-09-28 15:44:26 -07:00
Greg Clayton 8f8935139a Track which modules have debug info variable errors.
Now that we display an error when users try to get variables, but something in the debug info is preventing variables from showing up, track this with a new bool in each module's statistic information named "debugInfoHadVariableErrors".

This patch modifies the code to track when we have variable errors in a module and adds accessors to get/set this value. This value is used in the module statistics and we added a test to verify this value gets set correctly.

Differential Revision: https://reviews.llvm.org/D134508
2022-09-28 15:39:54 -07:00
Greg Clayton 15f83ab775 When there are variable errors, display an error in VS Code's local variables view.
After recent diffs that enable variable errors that stop variables from being correctly displayed when debugging, allow users to see these errors in the LOCALS variables in the VS Code UI. We do this by detecting when no variables are available and when there is an error to be displayed, and we add a single variable named "<error>" whose value is a string error that the user can read. This allows the user to be aware of the reason variables are not available and fix the issue. Previously if someone enabled "-gline-tables-only" or was debugging with DWARF in .o files or with .dwo files and those separate object files were missing or they were out of date, the user would see nothing in the variables view. Communicating these errors to the user is essential to a good debugging experience.

Differential Revision: https://reviews.llvm.org/D134333
2022-09-28 15:38:02 -07:00
Benjamin Kramer 23132508d9 [bazel] Port 3f050f6ac4 2022-09-29 00:12:46 +02:00
Rafael Auler e549ac072b [PERF2BOLT] Do not issue parsing error on weird build ids
In weird entries we were issueing a parse error. For example, in line 5 here:

6862acc063b0aa86595f52ff81628577df4296ff a.so
6862acc063b0aa86595f52ff81628577df4296ff a.so
6862acc063b0aa86595f52ff81628577df4296ff a.so
db758cb3c970044e78d5a4c99b011708a9995636 bin1
60326683eab31acfd03435d9ed4ff9a8         bin2
7d448e51851b4bdb33eac84f90e74628a14a5f00 b.so
742aa26e0211794356cc25f415c25230a26aa045 c.so

Error reading BOLT data input file: line 89, column 33: malformed field

Fix that.

Reviewed By: #bolt, Amir

Differential Revision: https://reviews.llvm.org/D134822
2022-09-28 14:41:55 -07:00
Fangrui Song a98cbf01fa [ELF] Remove unused Symbol::getSymbolSize. NFC 2022-09-28 14:32:26 -07:00
Kirsten Lee 3f050f6ac4 [mlir][transform] Add multi-buffering to the transform dialect
Add the plumbing necessary to call the memref dialect's multiBuffer
function. This will allow separation between choosing which buffers
to multi-buffer and the actual transform.

Alter the multibuffer function to return the newly created
allocation if multi-buffering succeeds. This is necessary to
communicate with the transform dialect hooks what allocation
multi-buffering created.

Reviewed By: ftynse, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D133985
2022-09-28 14:30:02 -07:00
LLVM GN Syncbot 1e818cd8e2 [gn build] Port e61d89efd7 2022-09-28 20:36:01 +00:00
Daniel Thornburgh e61d89efd7 [NFC] [Object] Create library to fetch debug info by build ID.
This creates a library for fetching debug info by build ID, whether
locally or remotely via debuginfod. The functionality was refactored
out of existing code in the Symboliize library. Existing utilities
were refactored to use this library.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D132504
2022-09-28 13:35:35 -07:00
Mahesh Ravishankar 97f919820b [mlir][TilingInterface] NFC Refactor of tile and fuse using `TilingInterface`.
This patch refactors the tiling and tile + fuse implementation using
`TilingInterface`. Primarily, it exposes the functionality as simple
utility functions instead of as a Pattern to allow calling it from a
pattern as it is done in the test today or from within the transform
dialect (in the future). This is a step towards deprecating similar
methods in Linalg dialect.

- The utility methods do not erase the root operations.
- The return value provides the values to use for replacements.

Differential Revision: https://reviews.llvm.org/D134144
2022-09-28 20:25:33 +00:00
Xiang Li 26129766df [DirectX backend] Support global ctor for DXILBitcodeWriter.
1. Save typed pointer type for GlobalVariable/Function instead of the ObjectType.
   This will allow use GlobalVariable/Function as value.
2. Save target type for global ctors for Constant.
3. In DXILBitcodeWriter::getTypeID, check PointerMap first for Constant case.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D133283
2022-09-28 13:23:56 -07:00
Arthur Eubanks f92481e79d [test][msan] Pin varg.cpp to -fno-sanitize-memory-param-retval
Should fix https://lab.llvm.org/buildbot#builders/19/builds/12736
2022-09-28 13:14:14 -07:00
Stanislav Mekhanoshin 5a3fe9a039 [AMDGPU] Move SIModeRegisterDefaults to SI MFI
It does not belong to a general AMDGPU MFI.

Differential Revision: https://reviews.llvm.org/D134666
2022-09-28 13:13:40 -07:00
Fangrui Song 7a58dd1046 [ELF] Refactor Symbol initialization and overwriting
Symbol::replace intends to overwrite a few fields (mostly Elf{32,64}_Sym
fields), but the implementation copies all fields then restores some old fields.
This is error-prone and wasteful. Add Symbol::overwrite to copy just the
needed fields and add other overwrite member functions to copy the extra
fields.
2022-09-28 13:11:31 -07:00
Nico Weber 90f7f24b20 try to fix build yet more after 16544cbe64 2022-09-28 15:40:52 -04:00
Nico Weber d4a6513aef try to fix build more after 16544cbe64 2022-09-28 15:35:46 -04:00
Martin Sebor a181de452d [clang] handle extended integer constant expressions in _Static_assert (PR #57687)
Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D134311
2022-09-28 13:27:58 -06:00
Nico Weber 74bab7d4a0 try to fix build after 16544cbe64 2022-09-28 15:18:15 -04:00
Yonghong Song 75be0482a2 [clang][DebugInfo] Emit debuginfo for non-constant case value
Currently, clang does not emit debuginfo for the switch stmt
case value if it is an enum value. For example,
  $ cat test.c
  enum { AA = 1, BB = 2 };
  int func1(int a) {
    switch(a) {
    case AA: return 10;
    case BB: return 11;
    default: break;
    }
    return 0;
  }
  $ llvm-dwarfdump test.o | grep AA
  $
Note that gcc does emit debuginfo for the same test case.

This patch added such a support with similar implementation
to CodeGenFunction::EmitDeclRefExprDbgValue(). With this patch,
  $ clang -g -c test.c
  $ llvm-dwarfdump test.o | grep AA
                  DW_AT_name    ("AA")
  $

Differential Revision: https://reviews.llvm.org/D134705
2022-09-28 12:10:48 -07:00
serge-sans-paille 16544cbe64 [iwyu] Move <cmath> out of llvm/Support/MathExtras.h
Interestingly, MathExtras.h doesn't use <cmath> declaration, so move it out of
that header and include it when needed.

No functional change intended, but there's no longer a transitive include
fromMathExtras.h to cmath.
2022-09-28 20:49:01 +02:00
serge-sans-paille 99c7f83b99 [iwyu] Move <iostream> out of llvm/DebugInfo/Symbolize/Markup.h header
It's only used in the implementation. No functional change intended.
2022-09-28 20:49:00 +02:00
Aiden Grossman 8d77f8fde7 [MLGO] Add per-instruction MBB frequencies to regalloc dev features
This commit adds in two new features to the ML regalloc eviction
analysis that can be used in ML models, a vector of MBB frequencies and
a vector of indicies mapping instructions to their corresponding basic
blocks. This will allow for further experimentation with per-instruction
features and give a lot more flexibility for future experimentation over
how we're extracting MBB frequency data currently.

Reviewed By: mtrofin, jacobhegna

Differential Revision: https://reviews.llvm.org/D134166
2022-09-28 18:45:04 +00:00
Jay Foad 2c12a04bba [ISel] Fix DAG divergence after new FMA combine
D132837 introduced a new DAG combine that used MorphNodeTo to morph an
FMUL into an FMA. It turns out that MorphNodeTo does not properly update
the divergence bit for users of the morphed node, causing an assertion
failure on the new test case:

llc: SelectionDAG.cpp:10486: void llvm::SelectionDAG::VerifyDAGDivergence(): Assertion `calculateDivergence(N) == N->isDivergent() && "Divergence bit inconsistency detected"' failed.

Fixing MorphNodeTo to propagate the divergence bit is tricky because of
the way it is used to select machine instructions, so use getNode and
ReplaceAllUsesOfValueWith instead.

Differential Revision: https://reviews.llvm.org/D134810
2022-09-28 19:41:51 +01:00
Aaron Ballman 2ad41f97f8 Repairing the release notes
A code block was separated from its release note, so this re-associates
them again. It also adds an example code block to another potentially
breaking change entry.
2022-09-28 14:34:37 -04:00
Qiongsi Wu ef399d1cfc [LTO][AIX] Invoking AIX System Assembler in LTO CodeGen
This patch teaches LTOCodeGenerator to call into the AIX system assembler to generate object files. This is in contrast to the approach taken on other platforms, where the LTOCodeGenerate calls the integrated assembler to generate object files.  We need to rely on the system assembler because the integrated assembler is incomplete at the moment.

Reviewed By: w2yehia, MaskRay

Differential Revision: https://reviews.llvm.org/D134375
2022-09-28 14:26:50 -04:00
Aaron Ballman 96a79cb308 Fix a tautological comparison bug caught during post-commit
This amends fd874e5fb1 to correctly set
the bit width of a '!' operator to be the same width as an 'int'. This
fixes a failed assertion about unexpected bit widths that was reported
during post-commit testing.
2022-09-28 14:23:28 -04:00
rkayaith 8dd3ff62f5 [mlir] Use 'GEN_PASS_DECL' for pass declarations
Most dialects are using a single a header for all their passes, switch
them over to using `GEN_PASS_DECL` instead of the individual macros.

Reviewed By: jpienaar, mehdi_amini, mscuttari

Differential Revision: https://reviews.llvm.org/D134814
2022-09-28 14:16:33 -04:00
Mingming Liu ac28efa6c1 [SimplifyCFG][TranformUtils]Do not simplify away a trivial basic block if both this block and at least one of its predecessors are loop latches.
- Before this patch, loop metadata (if exists) will override the metadata of each predecessor; if the predecessor block already has loop metadata, the orignal loop metadata won't be preserved and could cause missed loop transformations (see 'test2' in llvm/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll).

To illustrate how inner-loop metadata might be dropped before this patch:

CFG Before

      entry
        |
        v
 ---> while.cond   ------------->  while.end
 |       |
 |       v
 |   while.body
 |       |
 |       v
 |    for.body <---- (md1)
 |       |  |______|
 |       v
 |    while.cond.exit (md2)
 |       |
 |_______|

CFG After

       entry
         |
         v
 ---> while.cond.rewrite  ------------->  while.end
 |       |
 |       v
 |   while.body
 |       |
 |       v
 |    for.body <---- (md2)
 |_______|  |______|

Basically, when 'while.cond.exit' is folded into 'while.cond', 'md2' overrides 'md1' and 'md1' is dropped from the CFG.

Differential Revision: https://reviews.llvm.org/D134152
2022-09-28 10:48:14 -07:00
Aart Bik 4d06861950 [mlir][sparse] add "sort" to the compress op codegen
This revision also adds convenience methods to test the
dim level type/property (with the codegen being first client)

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D134776
2022-09-28 10:41:40 -07:00
Aaron Ballman c5983963de Speculatively fix the lldb build
This should fix the issues found by:
https://lab.llvm.org/buildbot/#/builders/68/builds/40172
2022-09-28 13:39:48 -04:00
Fangrui Song df6803d94b [ELF] Symbols: remove isPlaceholder() test for Defined/CommonSymbol. NFC 2022-09-28 10:39:31 -07:00
Aaron Ballman 60727d8569 [C2x] implement typeof and typeof_unqual
This implements WG14 N2927 and WG14 N2930, which together define the
feature for typeof and typeof_unqual, which get the type of their
argument as either fully qualified or fully unqualified. The argument
to either operator is either a type name or an expression. If given a
type name, the type information is pulled directly from the given name.
If given an expression, the type information is pulled from the
expression. Recursive use of these operators is allowed and has the
expected behavior (the innermost operator is resolved to a type, and
that's used to resolve the next layer of typeof specifier, until a
fully resolved type is determined.

Note, we already supported typeof in GNU mode as a non-conforming
extension and we are *not* exposing typeof_unqual as a non-conforming
extension in that mode, nor are we exposing typeof or typeof_unqual as
a nonconforming extension in other language modes. The GNU variant of
typeof supports a form where the parentheses are elided from the
operator when given an expression (e.g., typeof 0 i = 12;). When in C2x
mode, we do not support this extension.

Differential Revision: https://reviews.llvm.org/D134286
2022-09-28 13:27:52 -04:00
Huan Nguyen 153eeb4a5e [BOLT] Disable -lite when split function is present
In lite mode, BOLT only transforms a subset of functions, leave the
remaining functions intact.

For NoPIC, it is fine. BOLT can scan relocations and fix-up all refs
that point to any function body in the subset.

For no-split function PIC, it is fine. Since jump tables are intra-
procedural transfer, BOLT can find both the jump table base and the
target within same function. Thus, BOLT can update and/or move jump
tables.

However, it is wrong to process a subset of functions in split function
PIC. This is because BOLT does not know if functions in the subset are
isolated, i.e., cannot be accessed by functions out of the subset,
especially via split jump table.

For example, BOLT only process three functions A, B and C. Suppose that
A is reached via jump table from A.cold, which is not processed. When
A is moved (due to optimization), the jump table in A.cold is invalid.
We cannot fix-up this jump table since it is only recognized in A.cold,
which BOLT does not process.

Solution: Disable lite mode if split function is present.

Future improvement: In lite mode, if split function is found, BOLT
processes both functions in the subset and all of their sibling
fragments.

Test Plan:
```
ninja check-bolt
```

Reviewed By: Amir, maksfb

Differential Revision: https://reviews.llvm.org/D131283
2022-09-28 19:26:17 +02:00
Craig Topper 12357e88af [RISCV][SelectionDAGBuilder] Fix crash when copying a v1f32 vector between basic blocks.
On a rv64 without f32 or vector support, this will be passed across
the basic block as an i64. We need use i32 as an intermediate type
with bitcast and anyext/trunc.

Fixes PR58025

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D134758
2022-09-28 10:13:35 -07:00
Slava Zakharin 8985cfd939 [flang][runtime] Fixed identity value for REAL(16) == __float128.
std::numeric_limits<__float128>::max/lowest return 0.0, so recreate
value of FLT128_MAX ourselves to avoid using quadmath.h's FLT128_MAX
that is currently causes warnings with GCC -Wpedantic.

Differential Revision: https://reviews.llvm.org/D134496
2022-09-28 10:11:37 -07:00