Roman Lebedev [Tue, 21 Jul 2020 12:36:31 +0000 (15:36 +0300)]
[NFC][Reduce] Group llvm-reduce options into a group, uncluttering --help
Max Kazantsev [Wed, 22 Jul 2020 06:14:50 +0000 (13:14 +0700)]
[SimplifyCFG] Do not create unneeded PR Phi in block with convergent calls
We do not thread blocks with convergent calls, but this check was missing
when we decide to insert PR Phis into it (which we only do for threading).
Differential Revision: https://reviews.llvm.org/D83936
Reviewed By: nikic
Kai Luo [Wed, 22 Jul 2020 04:16:20 +0000 (04:16 +0000)]
[PowerPC] Fix wrong codegen when stack pointer has to realign performing dynalloc
Current powerpc backend generates wrong code sequence if stack pointer
has to realign if `-fstack-clash-protection` enabled. When probing
dynamic stack allocation, current `PREPARE_PROBED_ALLOCA` takes
`NegSizeReg` as input and returns
`FinalStackPtr`. `FinalStackPtr=StackPtr+ActualNegSize` is calculated
correctly, however code following `PREPARE_PROBED_ALLOCA` still uses
value of `NegSizeReg`, which does not contain `ActualNegSize` if
`MaxAlign > TargetAlign`, to calculate loop trip count and residual
number of bytes.
This patch is part of fix of
https://bugs.llvm.org/show_bug.cgi?id=46759.
Differential Revision: https://reviews.llvm.org/D84152
Kai Luo [Wed, 22 Jul 2020 04:13:18 +0000 (04:13 +0000)]
[PowerPC] Fix wrong codegen when stack pointer has to realign in prologue
Current powerpc backend generates wrong code sequence if stack pointer
has to realign if -fstack-clash-protection enabled. When probing in
prologue, backend should generate a subtraction instruction rather
than a `stux` instruction to realign the stack pointer.
This patch is part of fix of
https://bugs.llvm.org/show_bug.cgi?id=46759.
Differential Revision: https://reviews.llvm.org/D84218
Jonas Devlieghere [Wed, 22 Jul 2020 06:04:20 +0000 (23:04 -0700)]
[lldb] Adjust for getIntegerConstantExpression refactor
Kang Zhang [Wed, 22 Jul 2020 05:51:03 +0000 (05:51 +0000)]
[PowerPC] Fix the implicit operands in PredicateInstruction()
Summary:
In the function `PPCInstrInfo::PredicateInstruction()`, we will replace
non-Predicate Instructions to Predicate Instruction. But we forget add
the new implicit operands the new Predicate Instruction needed. This
patch is to fix this.
Reviewed By: jsji, efriedma
Differential Revision: https://reviews.llvm.org/D82390
Pushpinder Singh [Wed, 22 Jul 2020 05:06:50 +0000 (01:06 -0400)]
[OpenMP] Add missing RUN lines for OpenMP 4.5
Summary: This was missed when default version was upgraded to 5.0 (part of D81098)
Reviewers: saiislam, ABataev, jdoerfert
Reviewed By: saiislam
Subscribers: yaxunl, guansong, sstefan1, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84221
David Blaikie [Wed, 22 Jul 2020 04:51:59 +0000 (21:51 -0700)]
Follow-on fixes for get/isIntegerConstantExpression
Xing GUO [Wed, 22 Jul 2020 04:14:16 +0000 (12:14 +0800)]
[DWARFYAML] Make the length field of compilation units optional. NFC.
This patch makes the length field of compilation units optional (0 by
default).
David Blaikie [Mon, 13 Jul 2020 03:31:08 +0000 (20:31 -0700)]
Reapply "Rename/refactor isIntegerConstantExpression to getIntegerConstantExpression"
Reapply
49e5f603d40083dce9c05796e3cde3a185c3beba
which had been reverted in
c94332919bd922032e979b3ae3ced5ca5bdf9650.
Originally reverted because I hadn't updated it in quite a while when I
got around to committing it, so there were a bunch of missing changes to
new code since I'd written the patch.
Reviewers: aaron.ballman
Differential Revision: https://reviews.llvm.org/D76646
Xing GUO [Wed, 22 Jul 2020 02:16:52 +0000 (10:16 +0800)]
[DWARFYAML] Use yaml::Hex64 rather than uint64_t as length. NFC.
It's better to use yaml::Hex64 as length in the compilation unit.
Zequan Wu [Wed, 22 Jul 2020 02:15:58 +0000 (19:15 -0700)]
[Coverage] fix failed test case.
peter klausler [Wed, 22 Jul 2020 00:10:14 +0000 (17:10 -0700)]
[flang] Replay a FORMAT at the right position
When FORMAT control reaches the final parenthesis and data items
remain, we advance a record and revert to the beginning of the
FORMAT for further items. But when the FORMAT contains any
nested parenthesized group of editing descriptors, possibly
repeated, reversion must be to the beginning of the last such
top-level parenthesized group, including its repetition count.
Reviewed By: sscalpone, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D84281
peter klausler [Wed, 22 Jul 2020 00:57:06 +0000 (17:57 -0700)]
[flang] Fix source line continuation in potential macro calls (bugzilla 46768)
The prescanner looks for implicit continuation lines when
there are unclosed parentheses at the end of a line, so that
source preprocessing macro references with arguments that span
lines are recognized. The condition that determines this
implicit continuation has been put into a predicate member
function and corrected to apply only when the following line
is source (not a preprocessing directive, comment, &c.).
Fixes bugzilla #46768.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84280
peter klausler [Wed, 22 Jul 2020 00:37:35 +0000 (17:37 -0700)]
[flang] Implement byte-swapped external unformatted I/O in runtime
Add SetConvert() to the OPEN statement's runtime API.
Add ByteswapOption() to the main program's runtime API.
Check a $FORT_CONVERT environment variable, too, for
a swapping specifier.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84284
peter klausler [Wed, 22 Jul 2020 00:21:08 +0000 (17:21 -0700)]
[flang] Handle leading zeroes after decimal in REAL formatted input
Leading zero digits after the decimal mark were being dropped.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84282
Zequan Wu [Wed, 22 Jul 2020 01:01:19 +0000 (18:01 -0700)]
[Coverage] Fix coverage test cases.
peter klausler [Wed, 22 Jul 2020 00:25:46 +0000 (17:25 -0700)]
[flang] Check for misplaced labels
In fixed form source, complain when a label digit appears
outside the label field & when a non-digit appears in the label
field.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D84283
Chen Zheng [Wed, 22 Jul 2020 00:40:32 +0000 (20:40 -0400)]
[PowerPC] add store (load float*) pattern to isProfitableToHoist
store (load float*) can be optimized to store(load i32*) in InstCombine pass.
Add store (load float*) to isProfitableToHoist to make sure we don't break
the opt in InstCombine pass.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D82341
Brian Cain [Wed, 22 Jul 2020 00:47:38 +0000 (19:47 -0500)]
[test-release] fallback to py3's venv module
If virtualenv is not available, we can look for py3's venv instead. We only
use this particular env for installing and running the test suite.
Logan Smith [Wed, 22 Jul 2020 00:48:36 +0000 (17:48 -0700)]
Disable -Wsuggest-override for all remaining unittests/ directories
Logan Smith [Wed, 22 Jul 2020 00:40:26 +0000 (17:40 -0700)]
[lld] Disable -Wsuggest-override for unittests
Zequan Wu [Mon, 20 Jul 2020 19:57:03 +0000 (12:57 -0700)]
[Coverage] Add comment to skipped regions
Bug filled here: https://bugs.llvm.org/show_bug.cgi?id=45757.
Add comment to skipped regions so we don't track execution count for lines containing only comments.
Differential Revision: https://reviews.llvm.org/D84208
Juneyoung Lee [Wed, 22 Jul 2020 00:30:42 +0000 (09:30 +0900)]
[ValueTracking] Fix incorrect handling of canCreateUndefOrPoison
.. in isGuaranteedNotToBeUndefOrPoison.
This caused early exit of isGuaranteedNotToBeUndefOrPoison, making it return
imprecise result.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D84251
Wang, Pengfei [Tue, 21 Jul 2020 09:06:11 +0000 (17:06 +0800)]
[CFE] Add nomerge function attribute to inline assembly.
Sometimes we also want to avoid merging inline assembly. This patch add
the nomerge function attribute to inline assembly.
Reviewed By: zequanwu
Differential Revision: https://reviews.llvm.org/D84225
Amy Huang [Tue, 21 Jul 2020 23:54:52 +0000 (16:54 -0700)]
[PDB][NativeSession] Clean up some things in NativeSession.
-Use the actual sect/offset to keep track of symbols in the cache so they don't get created multiple times with different addresses.
-Remove getSymTag from PDBFunctionSymbol/PDBPublicSymbol because it's already implemented in the base class
-Merge the symbolizer test files for DIA and native, since the tests are the same.
-Implement getCompilandId for NativeLineNumber
Reviewed By: amccarth
Differential Revision: https://reviews.llvm.org/D84208
Logan Smith [Tue, 21 Jul 2020 23:38:35 +0000 (16:38 -0700)]
[clang] Disable -Wsuggest-override for unittests/
Adrian Prantl [Tue, 21 Jul 2020 23:03:56 +0000 (16:03 -0700)]
[NFC] Clean up doc comment and implementation for Module::isSubModuleOf.
Patch by Varun Gandhi!
Differential Revision: https://reviews.llvm.org/D84087
Matt Arsenault [Sun, 28 Jun 2020 14:06:26 +0000 (10:06 -0400)]
GlobalISel: Use Register and update comment physical register syntax
Amy Kwan [Tue, 21 Jul 2020 21:26:47 +0000 (16:26 -0500)]
[PowerPC][Power10] Add Vector Multiply/Mod/Divide Instruction Definitions and MC Tests
This patch adds the td definitions and asm/disasm tests for the following instructions:
- Vector Multiply Low Doubleword: vmulld
- Vector Modulus Word/Doubleword: vmodsw, vmoduw, vmodsd, vmodud
- Vector Divide Word/Doubleword: vdivsw, vdivuw, vdivsd, vdivud
- Vector Multiply High Word/Doubleword: vmulhsw, vmulhsd, vmulhuw, vmulhud
- Vector Divide Extended Word/Doubleword: vdivesw, vdiveuw, vdivesd, vdiveud
Differential Revision: https://reviews.llvm.org/D82929
Amara Emerson [Tue, 21 Jul 2020 22:15:39 +0000 (15:15 -0700)]
Revert "[AArch64][GlobalISel] Add post-legalize combine for sext_inreg(trunc(sextload)) -> copy"
This reverts commit
64eb3a4915f00cca9af4c305a9ff36209003cd7b.
It caused miscompiles with optimizations enabled. Reverting while I investigate.
Amara Emerson [Wed, 15 Jul 2020 00:15:27 +0000 (17:15 -0700)]
[AArch64][GlobalISel] Fix TLS accesses clobbering registers incorrectly.
This was happening because the BLR didn't have a use of the X0 arg register,
which would end up being re-used in high reg pressure situations.
The change also avoids hard coding the use of X0 for the sequence except to
copy the value for the call. ld64 should still be able to optimize it.
rdar://
65438258
Matt Arsenault [Tue, 21 Jul 2020 16:28:52 +0000 (12:28 -0400)]
AMDGPU/GlobalISel: Add some baseline degenerate call argument tests
Matt Arsenault [Tue, 21 Jul 2020 22:24:03 +0000 (18:24 -0400)]
AMDGPU/GlobalISel: Fix not erasing inst when lowering G_FRINT
Matt Arsenault [Fri, 17 Jul 2020 15:01:15 +0000 (11:01 -0400)]
GlobalISel: Legalize G_FPOWI
Matt Arsenault [Fri, 17 Jul 2020 14:26:23 +0000 (10:26 -0400)]
GlobalISel: Translate llvm.powi intrinsic
There are a few questionable things about this intrinsic and existing
DAG implementation. For some reason the intrinsic hardcodes the second
operand to be scalar-only i32, and SelectionDAG builder makes a
legalization decision based on whether the operand is constant.
Matt Arsenault [Thu, 7 May 2020 14:47:25 +0000 (10:47 -0400)]
AMDGPU: Start interpreting byref on kernel arguments
These are treated identically to value aggregates placed in the kernel
argument list. A %struct.foo or %struct.foo addrspace(4)*
byref(sizeof(%struct.foo)) align(alignof(%struct.foo)) argument should
produce the same offsets and argument metadata.
This handles all 3 kernel ABI implementations, and the two HSA
metadata emission paths.
Chris Morin [Tue, 21 Jul 2020 21:57:49 +0000 (14:57 -0700)]
[mlir][docs] Fix Markdown format in Language Reference
Differential Revision: https://reviews.llvm.org/D84271
Yaxun (Sam) Liu [Tue, 21 Jul 2020 20:54:41 +0000 (16:54 -0400)]
Fix pow and ldexp in HIP header
Matt Arsenault [Thu, 25 Jun 2020 15:40:25 +0000 (11:40 -0400)]
CodeGen: Add support for lowering byref attribute
Tue Ly [Thu, 9 Jul 2020 19:30:29 +0000 (15:30 -0400)]
Add implementations for fmin, fminf, and fminl. Testing infrastructure update is splitted to https://reviews.llvm.org/D83931.
Nikita Popov [Tue, 21 Jul 2020 21:07:22 +0000 (23:07 +0200)]
[SCCP] Add switch+range tests (NFC)
Simon Pilgrim [Tue, 21 Jul 2020 20:50:38 +0000 (21:50 +0100)]
[X86][AVX] getTargetShuffleMask - don't decode VBROADCAST(EXTRACT_SUBVECTOR(X,0)) patterns.
getTargetShuffleMask is used by the various "SimplifyDemanded" folds so we can't assume that the bypassed extract_subvector can be safely simplified - getFauxShuffleMask performs a more general decode that allows us to more safely catch many of these cases so the impact is minimal.
Sameer Arora [Thu, 2 Jul 2020 21:32:55 +0000 (14:32 -0700)]
[llvm-libtool-darwin] Allow flattening archives
Add support for flattening archives while creating static libraries.
Hence, can now pass archives as input in addition to Mach-O binaries.
Furthermore, archives themselves must only conatain Mach-O binaries. As
per cctools' libtool's behavior, llvm-libtool-darwin does not flatten
archives recursively.
Reviewed by alexshap, smeenai, jhenderson
Differential Revision: https://reviews.llvm.org/D83520
Tue Ly [Thu, 16 Jul 2020 06:29:08 +0000 (02:29 -0400)]
Update Test (EXPECT_EQ and friends) to accept __uint128_t and floating point types (float, double, long double).
Summary: Update Test (EXPECT_EQ and friends) to accept __uint128_t and floating point types (float, double, long double).
Reviewers: sivachandra
Subscribers: mgorny, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D83931
David Blaikie [Tue, 21 Jul 2020 20:35:52 +0000 (13:35 -0700)]
DebugInfo: Add missing comment from llvm/test/DebugInfo/X86/debug-macro-dwo.ll
Meant to include this in
63a45091e5f3fce525d7bb8823df95a468ae69d0
Aleksandr Platonov [Tue, 21 Jul 2020 20:30:19 +0000 (23:30 +0300)]
Revert "[clangd] Fixes in lit tests"
This reverts commit
ff63d6be93dc5958bf35d92919ce6fafcc611e89.
Matt Arsenault [Wed, 27 May 2020 13:36:42 +0000 (09:36 -0400)]
DAG: Handle expanding strict_fsub into fneg and strict_fadd
The AMDGPU handling of f16 vectors is terrible still since it gets
scalarized even when the vector operation is legal.
The code is is essentially duplicated between the non-strict and
strict case. Apparently no other expansions are currently trying to do
this. This is mostly because I found the behavior of
getStrictFPOperationAction to be confusing. In the ARM case, it would
expand strict_fsub even though it shouldn't due to the later check. At
that point, the logic required to check for legality was more complex
than just duplicating the 2 instruction expansion.
Sameer Arora [Wed, 1 Jul 2020 22:02:22 +0000 (15:02 -0700)]
[llvm-libtool-darwin] Add support for -static option
Add support for creating static libraries when the input includes only
Mach-O binaries (and not libraries/archives themselves).
Reviewed by alexshap, Ktwu, smeenai, jhenderson, MaskRay, mtrent
Differential Revision: https://reviews.llvm.org/D83002
diggerlin [Tue, 21 Jul 2020 20:03:04 +0000 (16:03 -0400)]
[AIX][XCOFF]emit extern linkage for the llvm intrinsic symbol
SUMMARY:
when we call memset, memcopy,memmove etc(this are llvm intrinsic function) in the c source code. the llvm will generate IR
like call call void @llvm.memset.p0i8.i32(i8* align 4 bitcast (%struct.S* @s to i8*), i8 %1, i32 %2, i1 false)
for c source code
bash> cat test_memset.call
struct S{
int a;
int b;
};
extern struct S s;
void bar() {
memset(&s, s.b, s.b);
}
like
%struct.S = type { i32, i32 }
@s = external global %struct.S, align 4
; Function Attrs: noinline nounwind optnone
define void @bar() #0 {
entry:
%0 = load i32, i32* getelementptr inbounds (%struct.S, %struct.S* @s, i32 0, i32 1), align 4
%1 = trunc i32 %0 to i8
%2 = load i32, i32* getelementptr inbounds (%struct.S, %struct.S* @s, i32 0, i32 1), align 4
call void @llvm.memset.p0i8.i32(i8* align 4 bitcast (%struct.S* @s to i8*), i8 %1, i32 %2, i1 false)
ret void
}
declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1 immarg) #1
If we want to let the aix as assembly compile pass without -u
it need to has following assembly code.
.extern .memset
(we do not output extern linkage for llvm instrinsic function.
even if we output the extern linkage for llvm intrinsic function, we should not out .extern llvm.memset.p0i8.i32,
instead of we should emit .extern memset)
for other llvm buildin function floatdidf . even if we do not call these function floatdidf in the c source code(the generated IR also do not the call __floatdidf . the function call
was generated in the LLVM optimized.
the function is not in the functions list of Module, but we still need to emit extern .__floatdidf
The solution for it as :
We record all the lllvm intrinsic extern symbol when transformCallee(), and emit all these symbol in the AsmPrinter::doFinalization(Module &M)
Reviewers: jasonliu, Sean Fertile, hubert.reinterpretcast,
Differential Revision: https://reviews.llvm.org/D78929
Akira Hatanaka [Tue, 21 Jul 2020 19:58:17 +0000 (12:58 -0700)]
Fix the data layout mangling specification for 'i686-pc-macho'
Use 'o' for the mangling specification instead of 'e'. This fixes an
error in the backend caused by a mismatch between the data layouts
generated by the backend and the frontend.
rdar://problem/
64168540
Dan Liew [Tue, 21 Jul 2020 18:54:51 +0000 (11:54 -0700)]
Avoid failing a CHECK in `DlAddrSymbolizer::SymbolizePC`.
Summary:
It turns out the `CHECK(addr >= reinterpret_cast<upt>(info.dli_saddr)`
can fail because on armv7s on iOS 9.3 `dladdr()` returns
`info.dli_saddr` with an address larger than the address we provided.
We should avoid crashing here because crashing in the middle of reporting
an issue is very unhelpful. Instead we now try to compute a function offset
if the value we get back from `dladdr()` looks sane, otherwise we don't
set the function offset.
A test case is included. It's basically a slightly modified version of
the existing `test/sanitizer_common/TestCases/Darwin/symbolizer-function-offset-dladdr.cpp`
test case that doesn't run on iOS devices right now.
More details:
In the concrete scenario on armv7s `addr` is `0x2195c870` and the returned
`info.dli_saddr` is `0x2195c871`.
This what LLDB says when disassembling the code.
```
(lldb) dis -a 0x2195c870
libdyld.dylib`<redacted>:
0x2195c870 <+0>: nop
0x2195c872 <+2>: blx 0x2195c91c ; symbol stub for: exit
0x2195c876 <+6>: trap
```
The value returned by `dladdr()` doesn't make sense because it points
into the middle of a instruction.
There might also be other bugs lurking here because I noticed that the PCs we
gather during stackunwinding (before changing them with
`StackTrace::GetPreviousInstructionPc()`) look a little suspicious (e.g. the
PC stored for the frame with fail to symbolicate is 0x2195c873) as they don't
look properly aligned. This probably warrants further investigation in the future.
rdar://problem/
65621511
Reviewers: kubamracek, yln
Subscribers: kristof.beyls, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D84262
Alexey Bataev [Mon, 20 Jul 2020 15:00:58 +0000 (11:00 -0400)]
[OPENMP]Fix PR46012: declare target pointer cannot be accessed in target region.
Summary:
Need to avoid an optimization for base pointer mapping for target data
directives.
Reviewers: jdoerfert, ye-luo
Subscribers: yaxunl, guansong, cfe-commits, sstefan1, caomhin
Tags: #clang
Differential Revision: https://reviews.llvm.org/D84182
Fangrui Song [Tue, 21 Jul 2020 19:23:10 +0000 (12:23 -0700)]
Revert D82927 "[Loop Fusion] Integrate Loop Peeling into Loop Fusion"
This reverts commit
bb8850d34d601d4edd75fd30c07821c05a726c42.
It broke 3 check-llvm-transforms-loopfusion tests in an ASAN build.
LoopFuse.cpp `for (BasicBlock *Pred : predecessors(BB)) {` may operate on a deleted BB.
David Green [Tue, 21 Jul 2020 18:51:04 +0000 (19:51 +0100)]
[ARM] Add MVE_TwoOpPattern. NFC
This commons out a chunk of the different two operand MVE patterns into
a single helper multidef. Or technically two multidef patterns so that
the Dup qr patterns can also get the same treatment. This is most of the
two address instructions that we have some codegen pattern for (not ones
that we select purely from intrinsics). It does not include shifts,
which are more spread out and will need some extra work to be given the
same treatment.
Differential Revision: https://reviews.llvm.org/D83219
Jim Ingham [Tue, 21 Jul 2020 18:32:55 +0000 (11:32 -0700)]
Remove the "bool" return from OptionValue::Clear and its subclasses.
Every override returns true and its return value is never checked. I can't
see how clearing an OptionValue could fail, or what you would
do if it did. The return serves no purpose.
Differential Revision: https://reviews.llvm.org/D84253
David Blaikie [Tue, 21 Jul 2020 18:26:55 +0000 (11:26 -0700)]
DebugInfo: make test/DebugInfo/X86/debug-macro-dwo.ll more comprehensive
The test doesn't really demonstrate the use of the debug_loc.dwo section
distinct from the debug_loc section for strings in debug_macro.dwo -
because there are no strings that appear uin debug_loc.dwo that weren't
already in debug_loc, so the indexes would remain the same even if the
section that was used was fixed (to use debug_loc.dwo as per spec).
Vedant Kumar [Tue, 21 Jul 2020 18:09:33 +0000 (11:09 -0700)]
[lldb/test] Skip test in TestBitfieldIvars.py instead of xfailing it
The test triggers an ASan exception, causing job failures on the
sanitizer bot.
As suggested by Shafik.
Aleksandr Platonov [Tue, 21 Jul 2020 18:19:32 +0000 (21:19 +0300)]
[clangd] Fixes in lit tests
Summary:
Changes:
- `background-index.test` Add Windows support.
- `did-change-configuration-params.test` Replace `cat | FileCheck` with `FileCheck --input-file`
- `test-uri-windows.test` This test did not run on Windows displite `REQUIRES: windows-gnu || windows-msvc` (replacement: `UNSUPPORTED: !(windows-gnu || windows-msvc)`).
Reviewers: sammccall, kadircet
Reviewed By: kadircet
Subscribers: njames93, ormris, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83759
Guozhi Wei [Tue, 21 Jul 2020 18:18:06 +0000 (11:18 -0700)]
[MBP] Use profile count to compute tail dup cost if it is available
Current tail duplication in machine block placement pass uses block frequency
information in cost model. But frequency number has only relative meaning
compared to other basic blocks in the same function. A large frequency number
doesn't mean it is hot and a small frequency number doesn't mean it is cold.
To overcome this problem, this patch uses profile count in cost model if it's
available. So we can tail duplicate real hot basic blocks.
Differential Revision: https://reviews.llvm.org/D83265
Hiroshi Yamauchi [Mon, 20 Jul 2020 22:11:38 +0000 (15:11 -0700)]
[PGO][PGSO] Add profile guided size optimization to loop vectorization legality.
Marco Vanotti [Tue, 21 Jul 2020 18:06:15 +0000 (11:06 -0700)]
[compiler-rt][asan] decommit shadow memory for unmaps in fuchsia.
This CL allows asan allocator in fuchsia to decommit shadow memory
for memory allocated using mmap.
Big allocations in asan end up being allocated via `mmap` and freed with
`munmap`. However, when that memory is freed, asan returns the
corresponding shadow memory back to the OS via a call to
`ReleaseMemoryPagesToOs`.
In fuchsia, `ReleaseMemoryPagesToOs` is a no-op: to be able to free
memory back to the OS, you have to hold a handle to the vmo you want to
modify, which is tricky at the ReleaseMemoryPagesToOs level as that
function is not exclusively used for shadow memory.
The function `__sanitizer_fill_shadow` fills a given shadow memory range
with a specific value, and if that value is 0 (unpoison) and the memory
range is bigger than a threshold parameter, it will decommit that memory
if it is all zeroes.
This CL modifies the `FlushUnneededASanShadowMemory` function in
`asan_poisoning.cpp` to add a call to `__sanitizer_fill_shadow` with
value and threshold = 0. This way, all the unneeded shadow memory gets
returned back to the OS.
A test for this behavior can be found in fxrev.dev/391974
Differential Revision: https://reviews.llvm.org/D80355
Change-Id: Id6dd85693e78a222f0329d5b2201e0da753e01c0
Andy Soffer [Tue, 21 Jul 2020 17:51:05 +0000 (17:51 +0000)]
[libTooling] In Clang Transformer, change `Metadata` field to deferred evaluation.
`Metadata` is being changed from an `llvm::Any` to a `MatchConsumer<llvm::Any>`
so that it's evaluation can be be dependent on on `MatchResult`s passed in.
Reviewed By: ymandel, gribozavr2
Differential Revision: https://reviews.llvm.org/D83820
Serge Pavlov [Tue, 21 Jul 2020 17:56:57 +0000 (00:56 +0700)]
Revert "[Windows] Fix limit on command line size"
This reverts commit
d4020ef7c474b5e695d77aa100d7f68dc0c66b4e. It broke
LLDB buildbot: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/17702.
Jon Roelofs [Mon, 20 Jul 2020 22:56:49 +0000 (16:56 -0600)]
[compiler-rt][test][profile] Fix missing include
... on systems where wait() isn't one of the declarations transitively included
via unistd.h (i.e. Darwin).
Differential Revision: https://reviews.llvm.org/D84207
aartbik [Tue, 21 Jul 2020 17:57:18 +0000 (10:57 -0700)]
[mlir] [VectorOps] Add scatter/gather operations to Vector dialect
Introduces the scatter/gather operations to the Vector dialect
(important memory operations for sparse computations), together
with a first reference implementation that lowers to the LLVM IR
dialect to enable running on CPU (and other targets that support
the corresponding LLVM IR intrinsics).
The operations can be used directly where applicable, or can be used
during progressively lowering to bring other memory operations closer to
hardware ISA support for a gather/scatter. The semantics of the operation
closely correspond to those of the corresponding llvm intrinsics.
Note that the operation allows for a dynamic index vector (which is
important for sparse computations). However, this first reference
lowering implementation "serializes" the address computation when
base + index_vector is converted to a vector of pointers. Exploring
how to use SIMD properly during these step is TBD. More general
memrefs and idiomatic versions of striding are also TBD.
Reviewed By: arpith-jacob
Differential Revision: https://reviews.llvm.org/D84039
Stefan Pintilie [Tue, 21 Jul 2020 17:27:18 +0000 (12:27 -0500)]
[NFC][PowerPC] Updated a number of Power PC tests used for PC Relative
Updated the tests to use -mcpu=pwr10 instead of -mcpu=future.
Updated the tests to include Big Endian testing.
Fangrui Song [Tue, 21 Jul 2020 17:18:10 +0000 (10:18 -0700)]
[LLVMgold.so][test] Fix tests after D84132/
55fa315b0352
Jonas Devlieghere [Tue, 21 Jul 2020 17:14:30 +0000 (10:14 -0700)]
[lldb] Add missing member initialziation list
My previous commit added the default arguments but didn't use them in
the member initialization list...
Raphael Isemann [Tue, 21 Jul 2020 17:03:33 +0000 (19:03 +0200)]
Revert "[lldb] Unify type name matching in FormattersContainer"
This reverts commit
5b0de5756ccc7a540926e4eeaa3b398539d88cd8.
Apparently that caused some test to get stuck on Linuxx. Reverting for now.
Nico Weber [Tue, 21 Jul 2020 15:44:47 +0000 (11:44 -0400)]
Build: Move TF source file inclusion from build system to source files
Outside of compiler-rt (where it's arguably an anti-pattern too),
LLVM tries to keep its build files as simple as possible. See e.g.
llvm/docs/SupportLibrary.rst, "Code Organization".
Differential Revision: https://reviews.llvm.org/D84243
Kevin P. Neal [Tue, 21 Jul 2020 16:55:25 +0000 (12:55 -0400)]
[NFC] Make documentation for CallBase::hasFnAttr() more clear.
Arthur Eubanks [Tue, 21 Jul 2020 16:48:22 +0000 (09:48 -0700)]
[NewPM] Support optnone under new pass manager
OptNoneInstrumentation is part of StandardInstrumentations. It skips
functions (or loops) that are marked optnone.
The feature of skipping optional passes for optnone functions under NPM
is gated on a -enable-npm-optnone flag. Currently it is by default
false. That is because we still need to mark all required passes to be
required. Otherwise optnone functions will start having incorrect
semantics. After that is done in following changes, we can remove the
flag and always enable this.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D83519
Jonas Devlieghere [Tue, 21 Jul 2020 16:49:12 +0000 (09:49 -0700)]
[lldb] Change the CommandArgumentData ctor (NFC)
By using default arguments the caller can specify a subset without the
need for overloads. This is particularly useful in combination with
emplace_back as these objects are generally stored in a vector.
Raphael Isemann [Tue, 21 Jul 2020 16:44:16 +0000 (18:44 +0200)]
[lldb] Unify type name matching in FormattersContainer
Summary:
FormattersContainer stores LLDB's formatters. It's implemented as a templated
map-like data structures that supports any kind of value type and only allows
ConstString and RegularExpression as the key types. The keys are used for
matching type names (e.g., the ConstString key `std::vector` matches the type
with the same name while RegularExpression keys match any type where the
RegularExpression instance matches).
The fact that a single FormattersContainer can only match either by string
comparison or regex matching (depending on the KeyType) causes us to always have
two FormatterContainer instances in all the formatting code. This also leads to
us having every type name matching logic in LLDB twice. For example,
TypeCategory has to implement every method twice (one string matching one, one
regex matching one).
This patch changes FormattersContainer to instead have a single `TypeMatcher`
key that wraps the logic for string-based and regex-based type matching and is
now the only possible KeyType for the FormattersContainer. This means that a
single FormattersContainer can now match types with both regex and string
comparison.
To summarize the changes in this patch:
* Remove all the `*_Impl` methods from `FormattersContainer`
* Instead call the FormatMap functions from `FormattersContainer` with a
`TypeMatcher` type that does the respective matching.
* Replace `ConstString` with `TypeMatcher` in the few places that directly
interact with `FormattersContainer`.
I'm working on some follow up patches that I split up because they deserve their
own review:
* Unify FormatMap and FormattersContainer (they are nearly identical now).
* Delete the duplicated half of all the type matching code that can now use one
interface.
* Propagate TypeMatcher through all the formatter code interfaces instead of
always offering two functions for everything.
There is one ugly design part that I couldn't get rid of yet and that is that we
have to support getting back the string used to construct a `TypeMatcher` later
on. The reason for this is that LLDB only supports referencing existing type
matchers by just typing their respective input string again (without even
supplying if it's a regex or not).
Reviewers: davide, mib
Reviewed By: mib
Subscribers: mgorny, JDevlieghere
Differential Revision: https://reviews.llvm.org/D84151
Jordan Rupprecht [Tue, 21 Jul 2020 16:26:01 +0000 (09:26 -0700)]
[NFC] Fix unused var warning
Jonas Devlieghere [Tue, 21 Jul 2020 16:13:00 +0000 (09:13 -0700)]
[lldb] Fix typo that went unnoticed on my case insensitive FS
Logan Smith [Tue, 21 Jul 2020 16:11:53 +0000 (09:11 -0700)]
[clang-tools-extra] Disable -Wsuggest-override for unittests/
This avoids massive warning spam due to the unit tests' use of gtest and gmock, which do not use the 'override' keyword in their sources.
Differential Revision: https://reviews.llvm.org/D84213
Diego Caballero [Tue, 21 Jul 2020 15:34:09 +0000 (08:34 -0700)]
[MLIR][EDSC] Add fptrunc and fpext to EDSC
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D84216
Jonas Devlieghere [Tue, 21 Jul 2020 15:59:44 +0000 (08:59 -0700)]
[lldb/Reproducers] Don't recursively record everything in the CWD
RecordInterestingDirectory was added to collect dSYM bundles and their
content. For the current working directory we only want the directory to
be part of the VFS, not necessarily its contents. This patch renames the
current method to RecordInterestingDirectoryRecursively and adds a new
one that's not recursive.
Sidharth Baveja [Tue, 21 Jul 2020 15:59:14 +0000 (15:59 +0000)]
[Loop Fusion] Integrate Loop Peeling into Loop Fusion
Summary:
This patch adds the ability to peel off iterations of the first loop in loop
fusion. This can allow for both loops to have the same trip count, making it
legal for them to be fused together.
Here is a simple scenario peeling can be used in loop fusion:
for (i = 0; i < 10; ++i)
a[i] = a[i] + 3;
for (j = 1; j < 10; ++j)
b[j] = b[j] + 5;
Here is we can make use of peeling, and then fuse the two loops together. We can
peel off the 0th iteration of the loop i, and then combine loop i and j for
i = 1 to 10.
a[0] = a[0] +3;
for (i = 1; i < 10; ++i) {
a[i] = a[i] + 3;
b[i] = b[i] + 5;
}
Currently peeling with loop fusion is only supported for loops with constant
trip counts and a single exit point. Both unguarded and guarded loops are
supported.
Author: sidbav (Sidharth Baveja)
Reviewers: kbarton, Meinersbur, bkramer, Whitney, skatkov, ashlykov, fhahn, bmahjour
Reviewed By: bmahjour
Subscribers: bmahjour, mgorny, hiraditya, zzheng
Tags: LLVM
Differential Revision: https://reviews.llvm.org/D82927
Chris Gyurgyik [Tue, 21 Jul 2020 15:52:12 +0000 (11:52 -0400)]
[libc] [Obvious] Fix typo.
Fixes typo for strstr in entrypoints.
str -> src.
Fangrui Song [Tue, 21 Jul 2020 15:49:04 +0000 (08:49 -0700)]
[ELF] -r: rewrite SHT_GROUP content if some members are combined or discarded
* If two group members are combined, we should leave just one index in the SHT_GROUP content.
* If a group member is discarded (/DISCARD/ or upcoming -r --gc-sections combination),
we should drop its index in the SHT_GROUP content. LLD currently crashes (`getOutputSection()` is null).
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D84129
cgyurgyik [Tue, 21 Jul 2020 15:37:36 +0000 (11:37 -0400)]
[libc] Add strstr implementation.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D83956
Vince Bridgers [Thu, 16 Jul 2020 17:55:32 +0000 (12:55 -0500)]
[ASTImporter] Refactor ASTImporter to support custom downstream tests
Summary:
The purpose of this change is to do a small refactoring of code in
ASTImporterTest.cpp by moving it to ASTImporterFixtures.h in order to
support tests of downstream custom types and minimize the "living
downstream burden" of frequent integrations from community to a
downstream repo that implements custom AST import tests.
Reviewers: martong, a.sidorin, shafik
Reviewed By: martong
Subscribers: balazske, dkrupp, bjope, rnkovacs, teemperor, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83970
Fangrui Song [Tue, 21 Jul 2020 15:24:42 +0000 (08:24 -0700)]
[llvm-readobj] Construct relocation-aware DWARFDataExtractor to decode .eh_frame addresses correctly
In an object file, a "PC Begin" field in a FDE is usually relocated by a
PC-relative relocation. Use a relocation-aware DWARFDataExtractor overload (with
DWARFContext and a reference to its internal .eh_frame representation) to decode
addresses correctly. In an object file, most sections have addresses of zero. So
the displayed addresses are almost always offsets relative to the start of the
associated text section.
DWARFContext::create handles .eh_frame and .rela.eh_frame by itself, so if there
are more than one .eh_frame (technically possible, but almost always erronerous
in practice), this will only handle the first one. Supporting multiple
.eh_frame is beyond the scope of this patch.
Reviewed By: grimar, jhenderson
Differential Revision: https://reviews.llvm.org/D84106
Saiyedul Islam [Tue, 21 Jul 2020 15:30:13 +0000 (15:30 +0000)]
[OpenMP] Temporarily disable failing runtime tests for clang-12
Following tests were disabled for clang-11 after upgrading to
version 5.0 in D82963:
1. openmp/runtime/test/env/kmp_set_dispatch_buf.c
2. openmp/runtime/test/worksharing/for/kmp_set_dispatch_buf.c
They are also failing for clang-12. Thus this temporary disabling
until they are fixed.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D84241
Jon Roelofs [Mon, 20 Jul 2020 14:47:07 +0000 (08:47 -0600)]
LoopIdiomRecognize: use ExpandedValuesCleaner in another place
This is a necessary cleanup after having expanded a SCEV.
See: https://reviews.llvm.org/D84071#inline-774728
Differential Revision: https://reviews.llvm.org/D84174
Jon Roelofs [Fri, 17 Jul 2020 20:58:44 +0000 (14:58 -0600)]
More conservatively report status from LoopIdiomRecognize
Being "precise" here is getting us into trouble with one of the
EXPENSIVE_CHECKS buildbots, see [1]. Rather than reporting IR additions that
later get rolled back as "no change", instead we now conservatively report that
there was.
1: http://lists.llvm.org/pipermail/llvm-dev/2020-July/143509.html
Differential Revision: https://reviews.llvm.org/D84071
Chris Morin [Mon, 20 Jul 2020 22:51:09 +0000 (15:51 -0700)]
Fix typo in tutorial
Mitch Phillips [Tue, 21 Jul 2020 15:19:02 +0000 (08:19 -0700)]
[GWP-ASan] Split the unwinder into segv/non-segv.
Note: Resubmission with frame pointers force-enabled to fix builds with
-DCOMPILER_RT_BUILD_BUILTINS=False
Summary:
Splits the unwinder into a non-segv (for allocation/deallocation traces) and a
segv unwinder. This ensures that implementations can select an accurate, slower
unwinder in the segv handler (if they choose to use the GWP-ASan provided one).
This is important as fast frame-pointer unwinders (like the sanitizer unwinder)
don't like unwinding through signal handlers.
Reviewers: morehouse, cryptoad
Reviewed By: morehouse, cryptoad
Subscribers: cryptoad, mgorny, eugenis, pcc, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D83994
Sander de Smalen [Mon, 20 Jul 2020 13:43:50 +0000 (14:43 +0100)]
[AArch64][SVE] Fix PCS for functions taking/returning scalable types.
The default calling convention needs to save/restore the SVE callee
saves according to the SVE PCS when the function takes or returns
scalable types, even when the `aarch64_sve_vector_pcs` CC is not
specified for the function.
Reviewers: efriedma, paulwalker-arm, david-arm, rengolin
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D84041
MaheshRavishankar [Tue, 21 Jul 2020 14:28:34 +0000 (07:28 -0700)]
[mlir][SPIR-V] Adding rationale for not using memref descriptors
SPIR-V lowering does not use `MemrefDescriptor`s when lowering memref
types. This adds rationale for the choice made.
Differential Revision: https://reviews.llvm.org/D84184
George Mitenkov [Tue, 21 Jul 2020 13:45:36 +0000 (16:45 +0300)]
[MLIR][LLVMDialect] SelectionOp conversion pattern
This patch introduces conversion pattern for `spv.selection` op.
The conversion can only be applied to selection with all blocks being
reachable. Moreover, selection with control attributes "Flatten" and
"DontFlatten" is not supported.
Since the `PatternRewriter` hook for block merging has not been implemented
for `ConversionPatternRewriter`, merge and continue blocks are kept
separately.
Reviewed By: antiagainst, ftynse
Differential Revision: https://reviews.llvm.org/D83860
Bruno Ricci [Tue, 21 Jul 2020 13:43:48 +0000 (14:43 +0100)]
[clang] Partially revert "Disable a few formatting options for test/"
The changes to "AlignTrailingComments" and "CommentPragmas" did not
result in what I expected (just leave the special comments alone).
Instead now the following:
void test() {
int i; // expected-error
// expected-warning
}
is formatted into:
void test() {
int i; // expected-error
// expected-warning
}
which is even worse.
AndreyChurbanov [Tue, 21 Jul 2020 13:31:17 +0000 (16:31 +0300)]
[OpenMP] add missed REQUIRES:ompt for 2 OMPT tests
Louis Dionne [Mon, 20 Jul 2020 17:13:38 +0000 (13:13 -0400)]
[compiler-rt] Use -nostdinc++ in clang_rt.profile to avoid including C++ headers
Most of the code in compiler_rt is C code. However, clang_rt.profile
contains the InstrProfilingRuntime.cpp file, which builds as C++. This
means that including e.g. <stdint.h> will actually include libc++'s
<stdint.h> and then #include_next the system's <stdint.h>. However, if
the target we're building compiler-rt for isn't supported by libc++,
this will lead to a failure since libc++'s <stdint.h> includes <__config>,
which performs various checks.
Since the goal seems to *not* be including any header from the C++ Standard
Library in clang_rt.profile, using -nostdinc++ to ensure that doesn't
happen unknowingly seems to make sense.
rdar://
65852694
Differential Revision: https://reviews.llvm.org/D84205
AndreyChurbanov [Tue, 21 Jul 2020 13:03:17 +0000 (16:03 +0300)]
[OpenMP] libomp build fix without OMPT_SUPPORT
Petre-Ionut Tudor [Tue, 14 Jul 2020 14:49:14 +0000 (15:49 +0100)]
[ARM] Generate [SU]HADD from ((a + b) >> 1)
Summary:
Teach LLVM to recognize the above pattern, where the operands are
either signed or unsigned types.
Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83777
Raphael Isemann [Tue, 21 Jul 2020 11:00:17 +0000 (13:00 +0200)]
[lldb] Remove FormattersContainer's name member
Summary:
FormattersContainer currently has an unused `m_name` member. Usually LLDB allows
giving objects names, but for the FormattersContainer it seems excessive. There
are only 4 FormattersContainer variables in LLDB and they are not usually passed
around, so one can always just go up a few frames when debugging to find out
which FormattersContainer you're dealing with.
Reviewers: mib, davide
Reviewed By: mib
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D84154