platform/upstream/llvm.git
4 years ago[Docs] Generate the LLDB man page with Sphinx
Jonas Devlieghere [Wed, 20 Nov 2019 22:53:37 +0000 (14:53 -0800)]
[Docs] Generate the LLDB man page with Sphinx

This patch replaces the existing out-of-date man page for lldb and
replaces it with an RST file from which sphinx generates the actual
troff file. This is similar to how man pages are generated for the rest
of the LLVM utilities.

The man page is generated by building the `docs-lldb-man` target.

Differential revision: https://reviews.llvm.org/D70514

4 years ago[SCEV] Be robust against IR generated by simple-loop-unswitch
Philip Reames [Thu, 21 Nov 2019 17:52:38 +0000 (09:52 -0800)]
[SCEV] Be robust against IR generated by simple-loop-unswitch

Simple loop unswitch likes to leave around unsimplified and/or/xors. SCEV today bails out on these idioms which is unfortunate in general, and specifically for the unswitch interaction.

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

4 years ago[ELF] Error if -Ttext-segment is specified
Fangrui Song [Tue, 19 Nov 2019 22:16:04 +0000 (14:16 -0800)]
[ELF] Error if -Ttext-segment is specified

In GNU ld, -Ttext sets the address of the .text section and -Ttext-segment sets the address of the text segment (RX).

gold only supports the -Ttext-segment semantic and treats -Ttext as an alias for -Ttext-segment.

lld only supports the -Ttext semantic and treats -Ttext-segment as an
alias for -Ttext.  The text segment will be assigned to an address less
than the specified -Ttext-segment value.

This patch drops the -Ttext-segment alias.

The text segment is traditionally the first segment. Users who specify
-Ttext-segment may actually want to specify --image-base, the lld way to
express this. Unfortunately currently this is supported by GNU ld's
COFF port but not by its ELF port. gold does not support this option.
With -z separate-code, the behavior of GNU ld -Ttext-segment is weird (see https://sourceware.org/bugzilla/show_bug.cgi?id=25207)

rL289827 introduced the alias for linking qemu's non-pie user mode
binaries. As explained previously, this actually assigns the text
segment to an address less than 0x60000000. I feel that a better fix is
on the qemu side:
https://lists.nongnu.org/archive/html/qemu-devel/2019-11/msg02480.html

Reviewed By: grimar, ruiu

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

4 years ago[llvm-objcopy][MachO] Implement --strip-debug
Fangrui Song [Mon, 18 Nov 2019 23:25:04 +0000 (15:25 -0800)]
[llvm-objcopy][MachO] Implement --strip-debug

Reviewed By: alexshap

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

4 years ago[llvm-objcopy][MachO] Fix symbol order in the symbol table
Fangrui Song [Wed, 20 Nov 2019 01:27:25 +0000 (17:27 -0800)]
[llvm-objcopy][MachO] Fix symbol order in the symbol table

Only consider isUndefinedSymbol() when the symbol is not local. This
fixes an assert failure when copying the symbol table, if a n_type=0x20
symbol is followed by a n_type=0x64 symbol.

Reviewed By: alexshap, seiya

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

4 years ago[BranchFolding] Fix PR43964 about branch folder not being debug invariant
Bjorn Pettersson [Mon, 11 Nov 2019 17:20:40 +0000 (18:20 +0100)]
[BranchFolding] Fix PR43964 about branch folder not being debug invariant

Summary:
The fix in BranchFolder related to non debug invariant problems
done in commit ec32dff0b075055 actually introduced some new
problems with debug invariance.

Before that patch ComputeCommonTailLength would move iterators
back, past debug instructions, in order to make ProfitableToMerge
make consistent answers "when one block differs from the other
only by whether debugging pseudos are present at the beginning".
But the changes in ec32dff0b075055 undid that by moving the iterators
forward again.

This patch refactors ComputeCommonTailLength. The function was
really complex, considering that the SkipTopCFIAndReturn part
always moved the iterators forward to the first "real" instruction
in the found tail after ec32dff0b075055.

The patch also restores the logic to "back past possible debugging
pseudos at beginning of block" to make sure ProfitableToMerge
gives consistent answers independent of DBG_VALUE instructions
before the tail. That is now done by ProfitableToMerge instead of
being hidden as a side-effect in ComputeCommonTailLength.

Reviewers: probinson, yechunliang, jmorse

Reviewed By: jmorse

Subscribers: Orlando, mehdi_amini, dexonsmith, aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix compilation warning. NFC.
Michael Liao [Thu, 21 Nov 2019 17:06:32 +0000 (12:06 -0500)]
Fix compilation warning. NFC.

4 years ago[NFC] Refactor and improve comments in CommandObjectTarget
Adrian McCarthy [Tue, 19 Nov 2019 20:51:00 +0000 (12:51 -0800)]
[NFC] Refactor and improve comments in CommandObjectTarget

Made small improvements while debugging through
CommandObjectTarget::AddModuleSymbols.

1.  Refactored error case for an early out, reducing the indentation of
the rest of this long function.
2.  Clarified some comments by correcting spelling and punctuation.
3.  Reduced duplicate code at the end of the function.

Tested with `ninja check-lldb`

Differential Review: https://reviews.llvm.org/D70458

4 years agoReduce the number of iterations in testcase. (NFC)
Adrian Prantl [Thu, 21 Nov 2019 16:32:42 +0000 (08:32 -0800)]
Reduce the number of iterations in testcase. (NFC)

4 years ago[OPENMP]Fix datasharing checks for if clause in parallel taskloop
Alexey Bataev [Thu, 21 Nov 2019 16:03:26 +0000 (11:03 -0500)]
[OPENMP]Fix datasharing checks for if clause in parallel taskloop
directives.

If the default datasharing is set to none, the datasharing attributes
for variables in the condition of the if clause for the inner taskloop
  directive must be verified.

4 years ago[InstCombine] add assert in SimplifyDemandedVectorElts and improve readability; NFC
Sanjay Patel [Wed, 20 Nov 2019 20:23:03 +0000 (15:23 -0500)]
[InstCombine] add assert in SimplifyDemandedVectorElts and improve readability; NFC

4 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Thu, 21 Nov 2019 16:09:19 +0000 (16:09 +0000)]
Fix unused variable warning. NFCI.

4 years agoLLD: Don't use the stderrOS stream in link before it's reassigned.
James Y Knight [Wed, 20 Nov 2019 15:08:18 +0000 (10:08 -0500)]
LLD: Don't use the stderrOS stream in link before it's reassigned.

Remove the lld::enableColors function, as it just obscures which
stream it's affecting, and replace with explicit calls to the stream's
enable_colors.

Also, assign the stderrOS and stdoutOS globals first in link function,
just to ensure nothing might use them.

(Either change individually fixes the issue of using the old
stream, but both together seems best.)

Follow-up to b11386f9be9b2dc7276a758d64f66833da10bdea.

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

4 years ago[Hexagon] Remove incorrect intrinsic definition and invalid testcase
Krzysztof Parzyszek [Thu, 21 Nov 2019 15:06:14 +0000 (09:06 -0600)]
[Hexagon] Remove incorrect intrinsic definition and invalid testcase

The intrinsic int_hexagon_S2_asr_i_vh was mapped to S2_asr_r_vh, which
is wrong. The testcase vasrh.select.ll was using an invalid immediate
for that intrinsic. This is not a proper testcase, since at the MIR
level such use of this intrinsic should never appear.

Together with 824b25fc02, this completes the fix for llvm.org/PR44090.

4 years ago[OPENMP50]Add if clause in for simd directive.
Alexey Bataev [Wed, 20 Nov 2019 20:59:03 +0000 (15:59 -0500)]
[OPENMP50]Add if clause in for simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause if false, the non-vectorized version of the
loop must be executed.

4 years ago[mips] Add a 'generic' Mips CPU
Miloš Stojanović [Thu, 21 Nov 2019 14:17:21 +0000 (15:17 +0100)]
[mips] Add a 'generic' Mips CPU

Having a generic CPU removes a warning when creating a subtarget without
the CPU being explicitly specified.

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

4 years ago[DAGCombiner] Use the right thumbv7meb triple for ARM big-endian test.
Clement Courbet [Thu, 21 Nov 2019 13:55:53 +0000 (14:55 +0100)]
[DAGCombiner] Use the right thumbv7meb triple for ARM big-endian test.

4 years ago[LV] PreferPredicateOverEpilog respecting option
Sjoerd Meijer [Thu, 21 Nov 2019 14:03:28 +0000 (14:03 +0000)]
[LV] PreferPredicateOverEpilog respecting option

Follow-up of cb47b8783: don't query TTI->preferPredicateOverEpilogue when
option -prefer-predicate-over-epilog is set to false, i.e. when we prefer not
to predicate the loop.

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

4 years ago[lldb][NFC] Modernize string handling in ClangExpressionDeclMap::FindExternalVisibleDecl
Raphael Isemann [Thu, 21 Nov 2019 13:40:45 +0000 (14:40 +0100)]
[lldb][NFC] Modernize string handling in ClangExpressionDeclMap::FindExternalVisibleDecl

4 years ago[lldb][NFC] Move searching functions in ClangExpressionDeclMap to own function
Raphael Isemann [Thu, 21 Nov 2019 12:58:48 +0000 (13:58 +0100)]
[lldb][NFC] Move searching functions in ClangExpressionDeclMap to own function

4 years ago[DeclCXX] Remove unknown external linkage specifications
Ehud Katz [Thu, 7 Nov 2019 10:28:48 +0000 (12:28 +0200)]
[DeclCXX] Remove unknown external linkage specifications

Partial revert of r372681 "Support for DWARF-5 C++ language tags".

The change introduced new external linkage languages ("C++11" and
"C++14") which not supported in C++.

It also changed the definition of the existing enum to use the DWARF
constants. The problem is that "LinkageSpecDeclBits.Language" (the field
that reserves this enum) is actually defined as 3 bits length
(bitfield), which cannot contain the new DWARF constants. Defining the
enum as integer literals is more appropriate for maintaining valid
values.

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

4 years ago[Debuginfo][NFC] removes redundant semicolon.
Alexey Lapshin [Thu, 21 Nov 2019 12:00:40 +0000 (15:00 +0300)]
[Debuginfo][NFC] removes redundant semicolon.

4 years ago[lldb][NFC] Reduce scope of some variables in ClangExpressionDeclMap::FindExternalVis...
Raphael Isemann [Thu, 21 Nov 2019 12:43:48 +0000 (13:43 +0100)]
[lldb][NFC] Reduce scope of some variables in ClangExpressionDeclMap::FindExternalVisibleDecls

4 years agoMake coding standards document more inclusive
Dmitri Gribenko [Tue, 19 Nov 2019 17:49:37 +0000 (18:49 +0100)]
Make coding standards document more inclusive

Summary: Patch by Doug Gregor, Tres Popp, and Dmitri Gribenko.

Reviewers: chandlerc

Subscribers: hfinkel, bmcreusillet, arsenm, doug.gregor, mgrang, arphaman, llvm-commits

Tags: #llvm

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

4 years agoRevert "[RISCV] Support mutilib in baremetal environment"
Zakk Chen [Thu, 21 Nov 2019 12:34:10 +0000 (04:34 -0800)]
Revert "[RISCV] Support mutilib in baremetal environment"

This reverts commit df876a026981b7a125b31bbb85ba4b1144edb0f9.
Clang::riscv32-toolchain.c Clang::riscv64-toolchain.c fails on Windows.

4 years ago[DAGCombiner] Add tests for thumb load-combine.
Clement Courbet [Thu, 21 Nov 2019 12:05:54 +0000 (13:05 +0100)]
[DAGCombiner] Add tests for thumb load-combine.

4 years agoStatistic - Fix MSVC shadow warning against global PrintOnExit static variable. NFC.
Simon Pilgrim [Thu, 21 Nov 2019 11:56:48 +0000 (11:56 +0000)]
Statistic - Fix MSVC shadow warning against global PrintOnExit static variable. NFC.

4 years agoFix Wshadow warning against global None variable. NFC.
Simon Pilgrim [Thu, 21 Nov 2019 11:54:35 +0000 (11:54 +0000)]
Fix Wshadow warning against global None variable. NFC.

4 years ago[lldb][NFC] Remove test directory completely
Tatyana Krasnukha [Thu, 21 Nov 2019 11:12:10 +0000 (14:12 +0300)]
[lldb][NFC] Remove test directory completely

The test was moved to "completion-in-lambda-and-unnamed-class" by D66175.

+ Fix typo in the directory name.

4 years ago[lldb][NFC] Move searching local variables into own function
Raphael Isemann [Thu, 21 Nov 2019 11:16:00 +0000 (12:16 +0100)]
[lldb][NFC] Move searching local variables into own function

4 years ago[Driver] Fix a shadowing warning. NFC
Ilya Biryukov [Thu, 21 Nov 2019 11:17:55 +0000 (12:17 +0100)]
[Driver] Fix a shadowing warning. NFC

Found by the following buildbot:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/30084

4 years ago[lldb][NFC] Move searching the ClangModulesDeclVendor into own function
Raphael Isemann [Thu, 21 Nov 2019 10:29:59 +0000 (11:29 +0100)]
[lldb][NFC] Move searching the ClangModulesDeclVendor into own function

4 years agoReland 9f3fdb0d7fab: [Driver] Use VFS to check if sanitizer blacklists exist
Ilya Biryukov [Thu, 21 Nov 2019 10:32:17 +0000 (11:32 +0100)]
Reland 9f3fdb0d7fab: [Driver] Use VFS to check if sanitizer blacklists exist

With updates to various LLVM tools that use SpecialCastList.

It was tempting to use RealFileSystem as the default, but that makes it
too easy to accidentally forget passing VFS in clang code.

4 years agodwarfdump --statistics: Use new location list api
Pavel Labath [Tue, 19 Nov 2019 14:14:59 +0000 (15:14 +0100)]
dwarfdump --statistics: Use new location list api

Summary:
This patch removes manual location list handling in the statistics code
and replaces it with the new DWARFDie api, which provides access to a
"cooked" location list. This has the following effects:
- the code now properly handles split-dwarf location lists
- it will automatically support dwarf5 location lists once support for
  those is added
- it properly handles location lists with base address selection entries
- it fixes a bug where the location list code was using the first
  DW_AT_ranges range as a "base address" of the compile unit (it should
  have used DW_AT_low_pc instead. The effect of this was that the
  computation of the start address of a variable in its scope was broken
  for these kinds of compile units. This only manifested itself on
  linked files, since in object files the first DW_AT_ranges range
  normally starts at 0.

Since pretty much every kind of location list was broken in some way,
it's hard to verify that the new implementation is correct -- the output
will be different in all non-trivial cases, and mostly with good reason.

Most of the existing statistics tests continue to pass though, and a
visual inspection of the statistics for non-trivial inputs shows that
the data is more "reasonable" now. I have updated the "dwo statistics"
test to include the new numbers, as the previous ones were completely
bogus, and I have added a targeted test for the "base address" bug.

Reviewers: dblaikie, cmtice, vsk

Subscribers: aprantl, SouraVX, JDevlieghere, djtodoro, llvm-commits

Tags: #llvm

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

4 years ago[mips] Rename test case. NFC
Simon Atanasyan [Thu, 21 Nov 2019 09:57:01 +0000 (12:57 +0300)]
[mips] Rename test case. NFC

4 years ago[mips] Remove unused `IsPCRelativeLoad` MIPS instructions attribute. NFC
Simon Atanasyan [Thu, 21 Nov 2019 09:48:23 +0000 (12:48 +0300)]
[mips] Remove unused `IsPCRelativeLoad` MIPS instructions attribute. NFC

This attribute is always set to zero.

4 years ago[mips] Remove addresses from the test case. NFC
Simon Atanasyan [Thu, 21 Nov 2019 09:34:05 +0000 (12:34 +0300)]
[mips] Remove addresses from the test case. NFC

It reduces "diff" after addition more tests in the future.

4 years agoRevert "[DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" shoul...
Benjamin Kramer [Thu, 21 Nov 2019 10:35:29 +0000 (11:35 +0100)]
Revert "[DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" should not be shared with general accesses. Fix for https://bugs.llvm.org/show_bug.cgi?id=42151"

Summary:
Revert "[DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" should not be shared with general accesses. Fix for https://bugs.llvm.org/show_bug.cgi?id=42151"

 This reverts commit 5f026b6d9e882941fde9b7e5dc0a2d807f7f24f5.

We're (tensorflow.org/xla team) seeing some misscompiles with the new change, only at -O3, with fast math disabled.

I'm still trying to come up with a useful/small/external example, but for now, the following IR:

```
; ModuleID = '__compute_module'
source_filename = "__compute_module"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"

@0 = private unnamed_addr constant [4 x i8] c"\DB\0F\C9@"
@1 = private unnamed_addr constant [4 x i8] c"\00\00\00?"

; Function Attrs: uwtable
define void @jit_wrapped_fun.31(i8* %retval, i8* noalias %run_options, i8** noalias %params, i8** noalias %buffer_table, i64* noalias %prof_counters) #0 {
entry:
  %fusion.invar_address.dim.2 = alloca i64
  %fusion.invar_address.dim.1 = alloca i64
  %fusion.invar_address.dim.0 = alloca i64
  %fusion.1.invar_address.dim.2 = alloca i64
  %fusion.1.invar_address.dim.1 = alloca i64
  %fusion.1.invar_address.dim.0 = alloca i64
  %0 = getelementptr inbounds i8*, i8** %buffer_table, i64 1
  %1 = load i8*, i8** %0, !invariant.load !0, !dereferenceable !1, !align !2
  %parameter.3 = bitcast i8* %1 to [2 x [1 x [4 x float]]]*
  %2 = getelementptr inbounds i8*, i8** %buffer_table, i64 5
  %3 = load i8*, i8** %2, !invariant.load !0, !dereferenceable !1, !align !2
  %fusion.1 = bitcast i8* %3 to [2 x [1 x [4 x float]]]*
  store i64 0, i64* %fusion.1.invar_address.dim.0
  br label %fusion.1.loop_header.dim.0

fusion.1.loop_header.dim.0:                       ; preds = %fusion.1.loop_exit.dim.1, %entry
  %fusion.1.indvar.dim.0 = load i64, i64* %fusion.1.invar_address.dim.0
  %4 = icmp uge i64 %fusion.1.indvar.dim.0, 2
  br i1 %4, label %fusion.1.loop_exit.dim.0, label %fusion.1.loop_body.dim.0

fusion.1.loop_body.dim.0:                         ; preds = %fusion.1.loop_header.dim.0
  store i64 0, i64* %fusion.1.invar_address.dim.1
  br label %fusion.1.loop_header.dim.1

fusion.1.loop_header.dim.1:                       ; preds = %fusion.1.loop_exit.dim.2, %fusion.1.loop_body.dim.0
  %fusion.1.indvar.dim.1 = load i64, i64* %fusion.1.invar_address.dim.1
  %5 = icmp uge i64 %fusion.1.indvar.dim.1, 1
  br i1 %5, label %fusion.1.loop_exit.dim.1, label %fusion.1.loop_body.dim.1

fusion.1.loop_body.dim.1:                         ; preds = %fusion.1.loop_header.dim.1
  store i64 0, i64* %fusion.1.invar_address.dim.2
  br label %fusion.1.loop_header.dim.2

fusion.1.loop_header.dim.2:                       ; preds = %fusion.1.loop_body.dim.2, %fusion.1.loop_body.dim.1
  %fusion.1.indvar.dim.2 = load i64, i64* %fusion.1.invar_address.dim.2
  %6 = icmp uge i64 %fusion.1.indvar.dim.2, 4
  br i1 %6, label %fusion.1.loop_exit.dim.2, label %fusion.1.loop_body.dim.2

fusion.1.loop_body.dim.2:                         ; preds = %fusion.1.loop_header.dim.2
  %7 = load float, float* bitcast ([4 x i8]* @0 to float*)
  %8 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %parameter.3, i64 0, i64 %fusion.1.indvar.dim.0, i64 0, i64 %fusion.1.indvar.dim.2
  %9 = load float, float* %8, !invariant.load !0, !noalias !3
  %10 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %parameter.3, i64 0, i64 %fusion.1.indvar.dim.0, i64 0, i64 %fusion.1.indvar.dim.2
  %11 = load float, float* %10, !invariant.load !0, !noalias !3
  %12 = fmul float %9, %11
  %13 = fmul float %7, %12
  %14 = call float @llvm.log.f32(float %13)
  %15 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %fusion.1, i64 0, i64 %fusion.1.indvar.dim.0, i64 0, i64 %fusion.1.indvar.dim.2
  store float %14, float* %15, !alias.scope !7, !noalias !8
  %invar.inc2 = add nuw nsw i64 %fusion.1.indvar.dim.2, 1
  store i64 %invar.inc2, i64* %fusion.1.invar_address.dim.2
  br label %fusion.1.loop_header.dim.2

fusion.1.loop_exit.dim.2:                         ; preds = %fusion.1.loop_header.dim.2
  %invar.inc1 = add nuw nsw i64 %fusion.1.indvar.dim.1, 1
  store i64 %invar.inc1, i64* %fusion.1.invar_address.dim.1
  br label %fusion.1.loop_header.dim.1

fusion.1.loop_exit.dim.1:                         ; preds = %fusion.1.loop_header.dim.1
  %invar.inc = add nuw nsw i64 %fusion.1.indvar.dim.0, 1
  store i64 %invar.inc, i64* %fusion.1.invar_address.dim.0
  br label %fusion.1.loop_header.dim.0

fusion.1.loop_exit.dim.0:                         ; preds = %fusion.1.loop_header.dim.0
  %16 = getelementptr inbounds i8*, i8** %buffer_table, i64 4
  %17 = load i8*, i8** %16, !invariant.load !0, !dereferenceable !9, !align !2
  %parameter.1 = bitcast i8* %17 to float*
  %18 = getelementptr inbounds i8*, i8** %buffer_table, i64 2
  %19 = load i8*, i8** %18, !invariant.load !0, !dereferenceable !10, !align !2
  %parameter.2 = bitcast i8* %19 to [3 x [1 x float]]*
  %20 = getelementptr inbounds i8*, i8** %buffer_table, i64 0
  %21 = load i8*, i8** %20, !invariant.load !0, !dereferenceable !11, !align !2
  %fusion = bitcast i8* %21 to [2 x [3 x [4 x float]]]*
  store i64 0, i64* %fusion.invar_address.dim.0
  br label %fusion.loop_header.dim.0

fusion.loop_header.dim.0:                         ; preds = %fusion.loop_exit.dim.1, %fusion.1.loop_exit.dim.0
  %fusion.indvar.dim.0 = load i64, i64* %fusion.invar_address.dim.0
  %22 = icmp uge i64 %fusion.indvar.dim.0, 2
  br i1 %22, label %fusion.loop_exit.dim.0, label %fusion.loop_body.dim.0

fusion.loop_body.dim.0:                           ; preds = %fusion.loop_header.dim.0
  store i64 0, i64* %fusion.invar_address.dim.1
  br label %fusion.loop_header.dim.1

fusion.loop_header.dim.1:                         ; preds = %fusion.loop_exit.dim.2, %fusion.loop_body.dim.0
  %fusion.indvar.dim.1 = load i64, i64* %fusion.invar_address.dim.1
  %23 = icmp uge i64 %fusion.indvar.dim.1, 3
  br i1 %23, label %fusion.loop_exit.dim.1, label %fusion.loop_body.dim.1

fusion.loop_body.dim.1:                           ; preds = %fusion.loop_header.dim.1
  store i64 0, i64* %fusion.invar_address.dim.2
  br label %fusion.loop_header.dim.2

fusion.loop_header.dim.2:                         ; preds = %fusion.loop_body.dim.2, %fusion.loop_body.dim.1
  %fusion.indvar.dim.2 = load i64, i64* %fusion.invar_address.dim.2
  %24 = icmp uge i64 %fusion.indvar.dim.2, 4
  br i1 %24, label %fusion.loop_exit.dim.2, label %fusion.loop_body.dim.2

fusion.loop_body.dim.2:                           ; preds = %fusion.loop_header.dim.2
  %25 = mul nuw nsw i64 %fusion.indvar.dim.2, 1
  %26 = add nuw nsw i64 0, %25
  %27 = udiv i64 %26, 4
  %28 = mul nuw nsw i64 %fusion.indvar.dim.0, 1
  %29 = add nuw nsw i64 0, %28
  %30 = udiv i64 %29, 2
  %31 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %fusion.1, i64 0, i64 %29, i64 0, i64 %26
  %32 = load float, float* %31, !alias.scope !7, !noalias !8
  %33 = mul nuw nsw i64 %fusion.indvar.dim.1, 1
  %34 = add nuw nsw i64 0, %33
  %35 = udiv i64 %34, 3
  %36 = load float, float* %parameter.1, !invariant.load !0, !noalias !3
  %37 = getelementptr inbounds [3 x [1 x float]], [3 x [1 x float]]* %parameter.2, i64 0, i64 %34, i64 0
  %38 = load float, float* %37, !invariant.load !0, !noalias !3
  %39 = fsub float %36, %38
  %40 = fmul float %39, %39
  %41 = mul nuw nsw i64 %fusion.indvar.dim.2, 1
  %42 = add nuw nsw i64 0, %41
  %43 = udiv i64 %42, 4
  %44 = mul nuw nsw i64 %fusion.indvar.dim.0, 1
  %45 = add nuw nsw i64 0, %44
  %46 = udiv i64 %45, 2
  %47 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %parameter.3, i64 0, i64 %45, i64 0, i64 %42
  %48 = load float, float* %47, !invariant.load !0, !noalias !3
  %49 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %parameter.3, i64 0, i64 %45, i64 0, i64 %42
  %50 = load float, float* %49, !invariant.load !0, !noalias !3
  %51 = fmul float %48, %50
  %52 = fdiv float %40, %51
  %53 = fadd float %32, %52
  %54 = fneg float %53
  %55 = load float, float* bitcast ([4 x i8]* @1 to float*)
  %56 = fmul float %54, %55
  %57 = getelementptr inbounds [2 x [3 x [4 x float]]], [2 x [3 x [4 x float]]]* %fusion, i64 0, i64 %fusion.indvar.dim.0, i64 %fusion.indvar.dim.1, i64 %fusion.indvar.dim.2
  store float %56, float* %57, !alias.scope !8, !noalias !12
  %invar.inc5 = add nuw nsw i64 %fusion.indvar.dim.2, 1
  store i64 %invar.inc5, i64* %fusion.invar_address.dim.2
  br label %fusion.loop_header.dim.2

fusion.loop_exit.dim.2:                           ; preds = %fusion.loop_header.dim.2
  %invar.inc4 = add nuw nsw i64 %fusion.indvar.dim.1, 1
  store i64 %invar.inc4, i64* %fusion.invar_address.dim.1
  br label %fusion.loop_header.dim.1

fusion.loop_exit.dim.1:                           ; preds = %fusion.loop_header.dim.1
  %invar.inc3 = add nuw nsw i64 %fusion.indvar.dim.0, 1
  store i64 %invar.inc3, i64* %fusion.invar_address.dim.0
  br label %fusion.loop_header.dim.0

fusion.loop_exit.dim.0:                           ; preds = %fusion.loop_header.dim.0
  %58 = getelementptr inbounds i8*, i8** %buffer_table, i64 3
  %59 = load i8*, i8** %58, !invariant.load !0, !dereferenceable !2, !align !2
  %tuple.30 = bitcast i8* %59 to [1 x i8*]*
  %60 = bitcast [2 x [3 x [4 x float]]]* %fusion to i8*
  %61 = getelementptr inbounds [1 x i8*], [1 x i8*]* %tuple.30, i64 0, i64 0
  store i8* %60, i8** %61, !alias.scope !14, !noalias !8
  ret void
}

; Function Attrs: nounwind readnone speculatable willreturn
declare float @llvm.log.f32(float) #1

attributes #0 = { uwtable "no-frame-pointer-elim"="false" }
attributes #1 = { nounwind readnone speculatable willreturn }

!0 = !{}
!1 = !{i64 32}
!2 = !{i64 8}
!3 = !{!4, !6}
!4 = !{!"buffer: {index:0, offset:0, size:96}", !5}
!5 = !{!"XLA global AA domain"}
!6 = !{!"buffer: {index:5, offset:0, size:32}", !5}
!7 = !{!6}
!8 = !{!4}
!9 = !{i64 4}
!10 = !{i64 12}
!11 = !{i64 96}
!12 = !{!13, !6}
!13 = !{!"buffer: {index:3, offset:0, size:8}", !5}
!14 = !{!13}
```

gets (correctly) optimized to the one below without the change:

```
; ModuleID = '__compute_module'
source_filename = "__compute_module"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"

; Function Attrs: nofree nounwind uwtable
define void @jit_wrapped_fun.31(i8* nocapture readnone %retval, i8* noalias nocapture readnone %run_options, i8** noalias nocapture readnone %params, i8** noalias nocapture readonly %buffer_table, i64* noalias nocapture readnone %prof_counters) local_unnamed_addr #0 {
entry:
  %0 = getelementptr inbounds i8*, i8** %buffer_table, i64 1
  %1 = bitcast i8** %0 to [2 x [1 x [4 x float]]]**
  %2 = load [2 x [1 x [4 x float]]]*, [2 x [1 x [4 x float]]]** %1, align 8, !invariant.load !0, !dereferenceable !1, !align !2
  %3 = getelementptr inbounds i8*, i8** %buffer_table, i64 5
  %4 = bitcast i8** %3 to [2 x [1 x [4 x float]]]**
  %5 = load [2 x [1 x [4 x float]]]*, [2 x [1 x [4 x float]]]** %4, align 8, !invariant.load !0, !dereferenceable !1, !align !2
  %6 = bitcast [2 x [1 x [4 x float]]]* %2 to <4 x float>*
  %7 = load <4 x float>, <4 x float>* %6, align 8, !invariant.load !0, !noalias !3
  %8 = fmul <4 x float> %7, %7
  %9 = fmul <4 x float> %8, <float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000>
  %10 = call <4 x float> @llvm.log.v4f32(<4 x float> %9)
  %11 = bitcast [2 x [1 x [4 x float]]]* %5 to <4 x float>*
  store <4 x float> %10, <4 x float>* %11, align 8, !alias.scope !7, !noalias !8
  %12 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %2, i64 0, i64 1, i64 0, i64 0
  %13 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %5, i64 0, i64 1, i64 0, i64 0
  %14 = bitcast float* %12 to <4 x float>*
  %15 = load <4 x float>, <4 x float>* %14, align 8, !invariant.load !0, !noalias !3
  %16 = fmul <4 x float> %15, %15
  %17 = fmul <4 x float> %16, <float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000>
  %18 = call <4 x float> @llvm.log.v4f32(<4 x float> %17)
  %19 = bitcast float* %13 to <4 x float>*
  store <4 x float> %18, <4 x float>* %19, align 8, !alias.scope !7, !noalias !8
  %20 = getelementptr inbounds i8*, i8** %buffer_table, i64 4
  %21 = bitcast i8** %20 to float**
  %22 = load float*, float** %21, align 8, !invariant.load !0, !dereferenceable !9, !align !2
  %23 = getelementptr inbounds i8*, i8** %buffer_table, i64 2
  %24 = bitcast i8** %23 to [3 x [1 x float]]**
  %25 = load [3 x [1 x float]]*, [3 x [1 x float]]** %24, align 8, !invariant.load !0, !dereferenceable !10, !align !2
  %26 = load i8*, i8** %buffer_table, align 8, !invariant.load !0, !dereferenceable !11, !align !2
  %27 = load float, float* %22, align 8, !invariant.load !0, !noalias !3
  %.phi.trans.insert28 = getelementptr inbounds [3 x [1 x float]], [3 x [1 x float]]* %25, i64 0, i64 2, i64 0
  %.pre29 = load float, float* %.phi.trans.insert28, align 8, !invariant.load !0, !noalias !3
  %28 = bitcast [3 x [1 x float]]* %25 to <2 x float>*
  %29 = load <2 x float>, <2 x float>* %28, align 8, !invariant.load !0, !noalias !3
  %30 = insertelement <2 x float> undef, float %27, i32 0
  %31 = shufflevector <2 x float> %30, <2 x float> undef, <2 x i32> zeroinitializer
  %32 = fsub <2 x float> %31, %29
  %33 = fmul <2 x float> %32, %32
  %shuffle30 = shufflevector <2 x float> %33, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1>
  %34 = fsub float %27, %.pre29
  %35 = fmul float %34, %34
  %36 = insertelement <4 x float> undef, float %35, i32 0
  %37 = shufflevector <4 x float> %36, <4 x float> undef, <4 x i32> zeroinitializer
  %shuffle = shufflevector <4 x float> %10, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %38 = fmul <4 x float> %7, %7
  %shuffle31 = shufflevector <4 x float> %38, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %39 = fdiv <8 x float> %shuffle30, %shuffle31
  %40 = fadd <8 x float> %shuffle, %39
  %41 = fmul <8 x float> %40, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %42 = bitcast i8* %26 to <8 x float>*
  store <8 x float> %41, <8 x float>* %42, align 8, !alias.scope !8, !noalias !12
  %43 = getelementptr inbounds i8, i8* %26, i64 32
  %44 = fdiv <4 x float> %37, %38
  %45 = fadd <4 x float> %10, %44
  %46 = fmul <4 x float> %45, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %47 = bitcast i8* %43 to <4 x float>*
  store <4 x float> %46, <4 x float>* %47, align 8, !alias.scope !8, !noalias !12
  %.phi.trans.insert = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %5, i64 0, i64 1, i64 0, i64 0
  %.phi.trans.insert12 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %2, i64 0, i64 1, i64 0, i64 0
  %48 = bitcast float* %.phi.trans.insert to <4 x float>*
  %49 = load <4 x float>, <4 x float>* %48, align 8, !alias.scope !7, !noalias !8
  %50 = bitcast float* %.phi.trans.insert12 to <4 x float>*
  %51 = load <4 x float>, <4 x float>* %50, align 8, !invariant.load !0, !noalias !3
  %shuffle.1 = shufflevector <4 x float> %49, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %52 = getelementptr inbounds i8, i8* %26, i64 48
  %53 = fmul <4 x float> %51, %51
  %shuffle31.1 = shufflevector <4 x float> %53, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %54 = fdiv <8 x float> %shuffle30, %shuffle31.1
  %55 = fadd <8 x float> %shuffle.1, %54
  %56 = fmul <8 x float> %55, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %57 = bitcast i8* %52 to <8 x float>*
  store <8 x float> %56, <8 x float>* %57, align 8, !alias.scope !8, !noalias !12
  %58 = getelementptr inbounds i8, i8* %26, i64 80
  %59 = fdiv <4 x float> %37, %53
  %60 = fadd <4 x float> %49, %59
  %61 = fmul <4 x float> %60, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %62 = bitcast i8* %58 to <4 x float>*
  store <4 x float> %61, <4 x float>* %62, align 8, !alias.scope !8, !noalias !12
  %63 = getelementptr inbounds i8*, i8** %buffer_table, i64 3
  %64 = bitcast i8** %63 to [1 x i8*]**
  %65 = load [1 x i8*]*, [1 x i8*]** %64, align 8, !invariant.load !0, !dereferenceable !2, !align !2
  %66 = getelementptr inbounds [1 x i8*], [1 x i8*]* %65, i64 0, i64 0
  store i8* %26, i8** %66, align 8, !alias.scope !14, !noalias !8
  ret void
}

; Function Attrs: nounwind readnone speculatable willreturn
declare <4 x float> @llvm.log.v4f32(<4 x float>) #1

attributes #0 = { nofree nounwind uwtable "no-frame-pointer-elim"="false" }
attributes #1 = { nounwind readnone speculatable willreturn }

!0 = !{}
!1 = !{i64 32}
!2 = !{i64 8}
!3 = !{!4, !6}
!4 = !{!"buffer: {index:0, offset:0, size:96}", !5}
!5 = !{!"XLA global AA domain"}
!6 = !{!"buffer: {index:5, offset:0, size:32}", !5}
!7 = !{!6}
!8 = !{!4}
!9 = !{i64 4}
!10 = !{i64 12}
!11 = !{i64 96}
!12 = !{!13, !6}
!13 = !{!"buffer: {index:3, offset:0, size:8}", !5}
!14 = !{!13}

```

and (incorrectly) optimized to the one below with the change:

```
; ModuleID = '__compute_module'
source_filename = "__compute_module"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"

; Function Attrs: nofree nounwind uwtable
define void @jit_wrapped_fun.31(i8* nocapture readnone %retval, i8* noalias nocapture readnone %run_options, i8** noalias nocapture readnone %params, i8** noalias nocapture readonly %buffer_table, i64* noalias nocapture readnone %prof_counters) local_unnamed_addr #0 {
entry:
  %0 = getelementptr inbounds i8*, i8** %buffer_table, i64 1
  %1 = bitcast i8** %0 to [2 x [1 x [4 x float]]]**
  %2 = load [2 x [1 x [4 x float]]]*, [2 x [1 x [4 x float]]]** %1, align 8, !invariant.load !0, !dereferenceable !1, !align !2
  %3 = getelementptr inbounds i8*, i8** %buffer_table, i64 5
  %4 = bitcast i8** %3 to [2 x [1 x [4 x float]]]**
  %5 = load [2 x [1 x [4 x float]]]*, [2 x [1 x [4 x float]]]** %4, align 8, !invariant.load !0, !dereferenceable !1, !align !2
  %6 = bitcast [2 x [1 x [4 x float]]]* %2 to <4 x float>*
  %7 = load <4 x float>, <4 x float>* %6, align 8, !invariant.load !0, !noalias !3
  %8 = fmul <4 x float> %7, %7
  %9 = fmul <4 x float> %8, <float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000>
  %10 = call <4 x float> @llvm.log.v4f32(<4 x float> %9)
  %11 = bitcast [2 x [1 x [4 x float]]]* %5 to <4 x float>*
  store <4 x float> %10, <4 x float>* %11, align 8, !alias.scope !7, !noalias !8
  %12 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %2, i64 0, i64 1, i64 0, i64 0
  %13 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %5, i64 0, i64 1, i64 0, i64 0
  %14 = bitcast float* %12 to <4 x float>*
  %15 = load <4 x float>, <4 x float>* %14, align 8, !invariant.load !0, !noalias !3
  %16 = fmul <4 x float> %15, %15
  %17 = fmul <4 x float> %16, <float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000, float 0x401921FB60000000>
  %18 = call <4 x float> @llvm.log.v4f32(<4 x float> %17)
  %19 = bitcast float* %13 to <4 x float>*
  store <4 x float> %18, <4 x float>* %19, align 8, !alias.scope !7, !noalias !8
  %20 = getelementptr inbounds i8*, i8** %buffer_table, i64 4
  %21 = bitcast i8** %20 to float**
  %22 = load float*, float** %21, align 8, !invariant.load !0, !dereferenceable !9, !align !2
  %23 = getelementptr inbounds i8*, i8** %buffer_table, i64 2
  %24 = bitcast i8** %23 to [3 x [1 x float]]**
  %25 = load [3 x [1 x float]]*, [3 x [1 x float]]** %24, align 8, !invariant.load !0, !dereferenceable !10, !align !2
  %26 = load i8*, i8** %buffer_table, align 8, !invariant.load !0, !dereferenceable !11, !align !2
  %27 = load float, float* %22, align 8, !invariant.load !0, !noalias !3
  %.phi.trans.insert28 = getelementptr inbounds [3 x [1 x float]], [3 x [1 x float]]* %25, i64 0, i64 2, i64 0
  %.pre29 = load float, float* %.phi.trans.insert28, align 8, !invariant.load !0, !noalias !3
  %28 = bitcast [3 x [1 x float]]* %25 to <2 x float>*
  %29 = load <2 x float>, <2 x float>* %28, align 8, !invariant.load !0, !noalias !3
  %30 = insertelement <2 x float> undef, float %27, i32 0
  %31 = shufflevector <2 x float> %30, <2 x float> undef, <2 x i32> zeroinitializer
  %32 = fsub <2 x float> %31, %29
  %33 = fmul <2 x float> %32, %32
  %shuffle32 = shufflevector <2 x float> %33, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1>
  %34 = fsub float %27, %.pre29
  %35 = fmul float %34, %34
  %36 = insertelement <4 x float> undef, float %35, i32 0
  %37 = shufflevector <4 x float> %36, <4 x float> undef, <4 x i32> zeroinitializer
  %shuffle = shufflevector <4 x float> %10, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %38 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %5, i64 0, i64 0, i64 0, i64 3
  %39 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %2, i64 0, i64 0, i64 0, i64 3
  %40 = fmul <4 x float> %7, %7
  %41 = shufflevector <4 x float> %40, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
  %42 = fdiv <8 x float> %shuffle32, %41
  %43 = fadd <8 x float> %shuffle, %42
  %44 = fmul <8 x float> %43, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %45 = bitcast i8* %26 to <8 x float>*
  store <8 x float> %44, <8 x float>* %45, align 8, !alias.scope !8, !noalias !12
  %46 = extractelement <4 x float> %10, i32 0
  %47 = getelementptr inbounds i8, i8* %26, i64 32
  %48 = extractelement <4 x float> %10, i32 1
  %49 = extractelement <4 x float> %10, i32 2
  %50 = load float, float* %38, align 4, !alias.scope !7, !noalias !8
  %51 = load float, float* %39, align 4, !invariant.load !0, !noalias !3
  %52 = fmul float %51, %51
  %53 = insertelement <4 x float> undef, float %52, i32 3
  %54 = fdiv <4 x float> %37, %53
  %55 = insertelement <4 x float> undef, float %46, i32 0
  %56 = insertelement <4 x float> %55, float %48, i32 1
  %57 = insertelement <4 x float> %56, float %49, i32 2
  %58 = insertelement <4 x float> %57, float %50, i32 3
  %59 = fadd <4 x float> %58, %54
  %60 = fmul <4 x float> %59, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %61 = bitcast i8* %47 to <4 x float>*
  store <4 x float> %60, <4 x float>* %61, align 8, !alias.scope !8, !noalias !12
  %.phi.trans.insert = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %5, i64 0, i64 1, i64 0, i64 0
  %.phi.trans.insert12 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %2, i64 0, i64 1, i64 0, i64 0
  %62 = bitcast float* %.phi.trans.insert to <4 x float>*
  %63 = load <4 x float>, <4 x float>* %62, align 8, !alias.scope !7, !noalias !8
  %64 = bitcast float* %.phi.trans.insert12 to <4 x float>*
  %65 = load <4 x float>, <4 x float>* %64, align 8, !invariant.load !0, !noalias !3
  %shuffle.1 = shufflevector <4 x float> %63, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %66 = getelementptr inbounds i8, i8* %26, i64 48
  %67 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %5, i64 0, i64 1, i64 0, i64 3
  %68 = getelementptr inbounds [2 x [1 x [4 x float]]], [2 x [1 x [4 x float]]]* %2, i64 0, i64 1, i64 0, i64 3
  %69 = fmul <4 x float> %65, %65
  %70 = shufflevector <4 x float> %69, <4 x float> undef, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  %71 = fdiv <8 x float> %shuffle32, %70
  %72 = fadd <8 x float> %shuffle.1, %71
  %73 = fmul <8 x float> %72, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %74 = bitcast i8* %66 to <8 x float>*
  store <8 x float> %73, <8 x float>* %74, align 8, !alias.scope !8, !noalias !12
  %75 = extractelement <4 x float> %69, i32 0
  %76 = extractelement <4 x float> %63, i32 0
  %77 = getelementptr inbounds i8, i8* %26, i64 80
  %78 = extractelement <4 x float> %69, i32 1
  %79 = extractelement <4 x float> %63, i32 1
  %80 = extractelement <4 x float> %69, i32 2
  %81 = extractelement <4 x float> %63, i32 2
  %82 = load float, float* %67, align 4, !alias.scope !7, !noalias !8
  %83 = load float, float* %68, align 4, !invariant.load !0, !noalias !3
  %84 = fmul float %83, %83
  %85 = insertelement <4 x float> undef, float %75, i32 0
  %86 = insertelement <4 x float> %85, float %78, i32 1
  %87 = insertelement <4 x float> %86, float %80, i32 2
  %88 = insertelement <4 x float> %87, float %84, i32 3
  %89 = fdiv <4 x float> %37, %88
  %90 = insertelement <4 x float> undef, float %76, i32 0
  %91 = insertelement <4 x float> %90, float %79, i32 1
  %92 = insertelement <4 x float> %91, float %81, i32 2
  %93 = insertelement <4 x float> %92, float %82, i32 3
  %94 = fadd <4 x float> %93, %89
  %95 = fmul <4 x float> %94, <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
  %96 = bitcast i8* %77 to <4 x float>*
  store <4 x float> %95, <4 x float>* %96, align 8, !alias.scope !8, !noalias !12
  %97 = getelementptr inbounds i8*, i8** %buffer_table, i64 3
  %98 = bitcast i8** %97 to [1 x i8*]**
  %99 = load [1 x i8*]*, [1 x i8*]** %98, align 8, !invariant.load !0, !dereferenceable !2, !align !2
  %100 = getelementptr inbounds [1 x i8*], [1 x i8*]* %99, i64 0, i64 0
  store i8* %26, i8** %100, align 8, !alias.scope !14, !noalias !8
  ret void
}

; Function Attrs: nounwind readnone speculatable willreturn
declare <4 x float> @llvm.log.v4f32(<4 x float>) #1

attributes #0 = { nofree nounwind uwtable "no-frame-pointer-elim"="false" }
attributes #1 = { nounwind readnone speculatable willreturn }

!0 = !{}
!1 = !{i64 32}
!2 = !{i64 8}
!3 = !{!4, !6}
!4 = !{!"buffer: {index:0, offset:0, size:96}", !5}
!5 = !{!"XLA global AA domain"}
!6 = !{!"buffer: {index:5, offset:0, size:32}", !5}
!7 = !{!6}
!8 = !{!4}
!9 = !{i64 4}
!10 = !{i64 12}
!11 = !{i64 96}
!12 = !{!13, !6}
!13 = !{!"buffer: {index:3, offset:0, size:8}", !5}
!14 = !{!13}

```

This results in bad numerical answers when used through XLA.
Again, it's not that easy to give a small fully-reproducible example, but the misscompare is:

```
Expected literal:
(
f32[2,3,4] {
{
  { nan, -inf, -3181.35, -inf },
  { nan, -inf, -28.2577019, -inf },
  { nan, -inf, -28.2577019, -inf }
},
{
  { -inf, -inf, -inf, -inf },
  { -6.60753046e+28, -1.47314833e+23, -inf, -inf },
  { -2.43504347e+30, -5.42892693e+24, -inf, -inf }
}
}
)

Actual literal:
(
f32[2,3,4] {
{
  { nan, -inf, -3181.35, -inf },
  { nan, -inf, -inf, -inf },
  { inf, -inf, -28.2577019, -inf }
},
{
  { -inf, -inf, -inf, -inf },
  { -6.60753046e+28, -1.47314833e+23, -inf, -inf },
  { -2.43504347e+30, -5.42892693e+24, -inf, -inf }
}
}
)
```

Reviewers: sanjoy.google, sanjoy, ebrevnov, jdoerfert, reames, chandlerc

Subscribers: hiraditya, Charusso, llvm-commits

Tags: #llvm

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

4 years ago[OpenCL] Fix address space for base method call (PR43145)
Sven van Haastregt [Thu, 21 Nov 2019 10:39:33 +0000 (10:39 +0000)]
[OpenCL] Fix address space for base method call (PR43145)

Clang was creating an UncheckedDerivedToBase ImplicitCastExpr that was
also casting between address spaces.  Insert an ImplicitCastExpr node
for doing the address space conversion.

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

4 years agoAtomics: support min/max orthogonally
Tim Northover [Thu, 21 Nov 2019 10:31:30 +0000 (10:31 +0000)]
Atomics: support min/max orthogonally

We seem to have been gradually growing support for atomic min/max operations
(exposing longstanding IR atomicrmw instructions). But until now there have
been gaps in the expected intrinsics. This adds support for the C11-style
intrinsics (i.e. taking _Atomic, rather than individually blessed by C11
standard), and the variants that return the new value instead of the original
one.

That way, people won't be misled by trying one form and it not working, and the
front-end is more friendly to people using _Atomic types, as we recommend.

4 years agoRevert "[Driver] Use VFS to check if sanitizer blacklists exist"
Ilya Biryukov [Thu, 21 Nov 2019 10:31:14 +0000 (11:31 +0100)]
Revert "[Driver] Use VFS to check if sanitizer blacklists exist"

This reverts commit ba6f906854263375cff3257d22d241a8a259cf77.
Commit caused compilation errors on llvm tests. Will fix and re-land.

4 years ago[COFF] Widen PE32Header fields to fit 64 bit versions
Martin Storsjö [Tue, 19 Nov 2019 09:29:04 +0000 (11:29 +0200)]
[COFF] Widen PE32Header fields to fit 64 bit versions

The PE32Header struct is only used by COFFYAML, for intermediate
storage. The struct doesn't match the on-disk struct layout as it
uses native integers instead of e.g. support::ulittle32_t, so just
widen the fields to fit values for object::pe32plus_header, in
addition to object::pe32_header.

This avoids truncating the 64 bit ImageBase for 64 bit executables.

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

4 years ago[lldb][NFC] Move searching for the local variable namespace into own function
Raphael Isemann [Thu, 21 Nov 2019 09:45:04 +0000 (10:45 +0100)]
[lldb][NFC] Move searching for the local variable namespace into own function

4 years ago[Driver] Use VFS to check if sanitizer blacklists exist
Ilya Biryukov [Thu, 21 Nov 2019 09:54:10 +0000 (10:54 +0100)]
[Driver] Use VFS to check if sanitizer blacklists exist

Summary:
This is a follow-up to 590f279c456bbde632eca8ef89a85c478f15a249, which
moved some of the callers to use VFS.

It turned out more code in Driver calls into real filesystem APIs and
also needs an update.

Reviewers: gribozavr2, kadircet

Reviewed By: kadircet

Subscribers: ormris, mgorny, hiraditya, llvm-commits, jkorous, cfe-commits

Tags: #clang, #llvm

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

4 years ago[AMDGPU] Add attribute for target loop unroll threshold default
Tim Corringham [Fri, 11 Oct 2019 15:55:39 +0000 (16:55 +0100)]
[AMDGPU] Add attribute for target loop unroll threshold default

Summary:
Add a function attribute to allow the target specific default loop unroll threshold
to be specified on a per-function basis. This allows a front-end to give guidance
where it has insight that is not available to the back-end, while still allowing the
target specific heuristics to also have an effect.

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[DebugInfo] Refactor DIExpression [SZ]Ext creation into function [NFC]
David Stenberg [Thu, 21 Nov 2019 08:45:20 +0000 (09:45 +0100)]
[DebugInfo] Refactor DIExpression [SZ]Ext creation into function [NFC]

Summary:
Also, replace the SmallVector with a normal C array.

Reviewers: vsk

Reviewed By: vsk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Early exit in ClangExpressionDeclMap::FindExternalVisibleDecls
Raphael Isemann [Wed, 20 Nov 2019 15:12:50 +0000 (16:12 +0100)]
[lldb][NFC] Early exit in ClangExpressionDeclMap::FindExternalVisibleDecls

4 years ago[compiler-rt] Don't check XCR0 when detecting avx512 on Darwin.
Florian Hahn [Thu, 21 Nov 2019 09:18:58 +0000 (09:18 +0000)]
[compiler-rt] Don't check XCR0 when detecting avx512 on Darwin.

Darwin lazily saves the AVX512 context on first use [1]: instead of checking
that it already does to figure out if the OS supports AVX512, trust that
the kernel will do the right thing and always assume the context save
support is available.

[1] https://github.com/apple/darwin-xnu/blob/xnu-4903.221.2/osfmk/i386/fpu.c#L174

Reviewers: ab, RKSimon, craig.topper

Reviewed By: craig.topper

Subscribers: dberris, JDevlieghere, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[Support] Don't check XCR0 when detecting avx512 on Darwin.
Florian Hahn [Thu, 21 Nov 2019 09:03:16 +0000 (09:03 +0000)]
[Support] Don't check XCR0 when detecting avx512 on Darwin.

Darwin lazily saves the AVX512 context on first use [1]: instead of checking
that it already does to figure out if the OS supports AVX512, trust that
the kernel will do the right thing and always assume the context save
support is available.

[1] https://github.com/apple/darwin-xnu/blob/xnu-4903.221.2/osfmk/i386/fpu.c#L174

Reviewers: ab, RKSimon, craig.topper

Reviewed By: craig.topper

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

4 years ago[RISCV] Support mutilib in baremetal environment
Zakk Chen [Thu, 21 Nov 2019 09:12:48 +0000 (01:12 -0800)]
[RISCV] Support mutilib in baremetal environment

1. Currently only support the set of multilibs same to riscv-gnu-toolchain.
2. Fix testcase typo causes fail on Windows

Reviewers: espindola, asb, kito-cheng, lenary

Reviewed By: lenary

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

4 years ago[libcxx] Add Sergej Jaskiewicz to CREDITS.txt
Sergej Jaskiewicz [Thu, 21 Nov 2019 08:02:01 +0000 (11:02 +0300)]
[libcxx] Add Sergej Jaskiewicz to CREDITS.txt

Summary: Also, test commit access

Reviewers: EricWF

Subscribers: christof, ldionne, libcxx-commits

Tags: #libc

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

4 years ago[clangd] Reland b5135a86e0476: Fix a crash in expected types
Ilya Biryukov [Wed, 20 Nov 2019 14:51:18 +0000 (15:51 +0100)]
[clangd] Reland b5135a86e0476: Fix a crash in expected types

Reverted in 6de45772e0910bf7fa626e5493a2798b071eb26c.
With a fix to Windows tests.

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

4 years ago[DAGCombine][NFC] Use ArrayRef and correctly size SmallVectors.
Clement Courbet [Thu, 21 Nov 2019 07:47:10 +0000 (08:47 +0100)]
[DAGCombine][NFC] Use ArrayRef and correctly size SmallVectors.

In preparation for D70487.

4 years agoD'oh. Fix assert after a84922916e6eddf701b39fbd7fe0222cb0fee1d6.
James Y Knight [Thu, 21 Nov 2019 03:18:45 +0000 (22:18 -0500)]
D'oh. Fix assert after a84922916e6eddf701b39fbd7fe0222cb0fee1d6.
(Which was attempting to fix unused variable warning in NDEBUG mode after 8ba56f322abf848cec78ff7f814f3ad84cd778be)

4 years ago[clang][IFS][test] GreenDragon and Fuchsia Darwin bot fix: BindArchClass Nest.
Puyan Lotfi [Thu, 21 Nov 2019 02:40:04 +0000 (21:40 -0500)]
[clang][IFS][test] GreenDragon and Fuchsia Darwin bot fix: BindArchClass Nest.

On Darwin the clang driver does not invoke Driver::BuildActions directly
due to the need to handle Universal apps. Because of this there is a
difference in code path where Driver::BuildUniversalActions is called
instead of Driver::BuildActions. BuildUniversalActions ends up calling
Driver::BuildAction but what it does differently is it takes the driver
actions returned and wraps them each into a BindArchAction.

In Driver::BuildJobs there is a check for '-o' to determine that
multiple files are not specified when passing -o, except for Clang
Interface Stub this need to be an exception as we actually want to write
out multiple files: for every libfoo.so we have a libfoo.ifso sidecar
ifso file, etc. To allow this to happen there is a check for
IfsMergeAction, which is permitted to write out a secondary file. Except
on Darwin, the IfsMergeAction gets wrapped in the BindArchAction by
Driver::BuildUniversalActions so the check fails.

This patch is to look inside a BindArchAction in Driver::BuildJobs to
determine if there is in fact an IfsMergeAction, and if-so (pun intended)
allow the secondary sidecard ifs/ifso file to be written out.

4 years agoFix unused variable warning in NDEBUG mode after 8ba56f322abf848cec78ff7f814f3ad84cd778be
James Y Knight [Thu, 21 Nov 2019 03:04:54 +0000 (22:04 -0500)]
Fix unused variable warning in NDEBUG mode after 8ba56f322abf848cec78ff7f814f3ad84cd778be

4 years agoTablegen: Remove the error for duplicate include files.
River Riddle [Thu, 21 Nov 2019 02:21:50 +0000 (18:21 -0800)]
Tablegen: Remove the error for duplicate include files.

This error was originally added a while(7 years) ago when
including multiple files was basically always an error. Tablegen
now has preprocessor support, which allows for building nice
c/c++ style include guards. With the current error being
reported, we unfortunately need to double guard when including
files:

* In user of MyFile.td

 #ifndef MYFILE_TD
 include MyFile.td
 #endif

* In MyFile.td

 #ifndef MYFILE_TD
 #define MYFILE_TD
 ...
 #endif

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

4 years ago[Error] Remove a broken code fragment accidentally included in 76bcbaafab2.
Lang Hames [Thu, 21 Nov 2019 01:50:22 +0000 (17:50 -0800)]
[Error] Remove a broken code fragment accidentally included in 76bcbaafab2.

4 years ago[Orc][Modules] Fix Modules build fallout from a34680a33eb.
Lang Hames [Thu, 21 Nov 2019 01:27:44 +0000 (17:27 -0800)]
[Orc][Modules] Fix Modules build fallout from a34680a33eb.

In a34680a33eb OrcError.h and Orc/RPC/*.h were split out from the rest of
ExecutionEngine in order to eliminate false dependencies for remote JIT
targets (see https://reviews.llvm.org/D68732), however this broke modules
builds (see https://reviews.llvm.org/D69817).

This patch splits these headers out into a separate module, LLVM_OrcSupport,
in order to fix the modules build.

Fixes <rdar://56377508>.

4 years ago[MemorySSA] Moving at the end often means before terminator.
Alina Sbirlea [Thu, 21 Nov 2019 00:09:37 +0000 (16:09 -0800)]
[MemorySSA] Moving at the end often means before terminator.

Moving accesses in MemorySSA at InsertionPlace::End, when an instruction is
moved into a block, almost always means insert at the end of the block, but
before the block terminator. This matters when the block terminator is a
MemoryAccess itself (an invoke), and the insertion must be done before
the terminator for the update to be correct.

Insert an additional position: InsertionPlace:BeforeTerminator and update
current usages where this applies.

Resolves PR44027.

4 years ago[X86] Fix i16->f128 sitofp to promote the i16 to i32 before trying to form a libcall.
Craig Topper [Thu, 21 Nov 2019 00:47:52 +0000 (16:47 -0800)]
[X86] Fix i16->f128 sitofp to promote the i16 to i32 before trying to form a libcall.

Previously one of the test cases added here gave an error.

4 years ago[X86] Fix f128->i16 fptosi to promote the i16 to i32 before trying to form a libcall.
Craig Topper [Thu, 21 Nov 2019 00:26:45 +0000 (16:26 -0800)]
[X86] Fix f128->i16 fptosi to promote the i16 to i32 before trying to form a libcall.

Previously one of the test cases added here gave an error.

4 years agoFix an offset underflow bug in DwarfExpression when describing small values with...
Adrian Prantl [Wed, 20 Nov 2019 21:02:23 +0000 (13:02 -0800)]
Fix an offset underflow bug in DwarfExpression when describing small values with subregisters

DwarfExpression::addMachineReg() knows how to build a larger register
that isn't expressible in DWARF by combining multiple
subregisters. However, if the entire value fits into just one
subregister, it would still emit the other subregisters, leading to
all sorts of inconsistencies down the line.

This patch fixes that by moving an already existing(!) check whether
the subregister's offset is before the end of the value to the right
place.

rdar://problem/57294211

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

4 years agoPrecommit tests for forthcoming widenable.condition transforms
Philip Reames [Thu, 21 Nov 2019 01:02:04 +0000 (17:02 -0800)]
Precommit tests for forthcoming widenable.condition transforms

4 years ago[docs] Tiny rewording in the portability FAQ entry
Josh Kunz [Thu, 21 Nov 2019 00:33:18 +0000 (16:33 -0800)]
[docs] Tiny rewording in the portability FAQ entry

The entry reads better with these two words swapped.

4 years ago[MemorySSA] Update analysis when the terminator is a memory instruction.
Alina Sbirlea [Wed, 20 Nov 2019 21:44:51 +0000 (13:44 -0800)]
[MemorySSA] Update analysis when the terminator is a memory instruction.

Update MemorySSA when moving the terminator instruction, as that may be a memory touching instruction.
Resolves PR44029.

4 years ago[ADT] Move to_vector from STLExtras.h to SmallVector.h
Reid Kleckner [Wed, 20 Nov 2019 23:59:16 +0000 (15:59 -0800)]
[ADT] Move to_vector from STLExtras.h to SmallVector.h

Nothing breaks, so this probably has zero impact, but it seems nice,
since to_vector is more like makeArrayRef, and should really live in
SmallVector.h.

4 years ago[Sema] Add a 'Semantic' parameter to Expr::isKnownToHaveBooleanValue
Erik Pilkington [Wed, 20 Nov 2019 23:39:22 +0000 (15:39 -0800)]
[Sema] Add a 'Semantic' parameter to Expr::isKnownToHaveBooleanValue

Some clients of this function want to know about any expression that is known
to produce a 0/1 value, and others care about expressions that are semantically
boolean.

This fixes a -Wswitch-bool regression I introduced in 8bfb353bb33c, pointed out
by Chris Hamilton!

4 years agogn build: check-clang depends on llvm-cxxfilt.
Peter Collingbourne [Thu, 21 Nov 2019 00:25:28 +0000 (16:25 -0800)]
gn build: check-clang depends on llvm-cxxfilt.

4 years agoRevert "[AArch64] Add the pipeline model for Exynos M5"
Eric Christopher [Thu, 21 Nov 2019 00:04:52 +0000 (16:04 -0800)]
Revert "[AArch64] Add the pipeline model for Exynos M5"
as it's causing test failures in llvm-mca.

This reverts commit 9bdfee2a3bd13d405ce1592930182f23849d2897.

4 years agoTemporarily Revert "[SLP] allow forming 2-way reduction patterns" and update testcases.
Eric Christopher [Thu, 21 Nov 2019 00:00:53 +0000 (16:00 -0800)]
Temporarily Revert "[SLP] allow forming 2-way reduction patterns" and update testcases.

After speaking with Sanjay - seeing a number of miscompiles and working
on tracking down a testcase. None of the follow on patches seem to
have helped so far.

This reverts commit 8a0aa5310bccbb42d16d11db090419fcefdd1376.

4 years agoTemporarily Revert "Temporarily Revert "[SLP] allow forming 2-way reduction patterns""
Eric Christopher [Wed, 20 Nov 2019 23:39:47 +0000 (15:39 -0800)]
Temporarily Revert "Temporarily Revert "[SLP] allow forming 2-way reduction patterns""
as there were testcase changes after that need to also be reverted.

This reverts commit cd8748a15f2d18861b3548eb26ed2b52e5ee50b4.

4 years ago[BPF] Fix a bug in peephole optimization
Yonghong Song [Wed, 20 Nov 2019 17:52:29 +0000 (09:52 -0800)]
[BPF] Fix a bug in peephole optimization

One of current peephole optimiations is to remove SLL/SRL if
the sub register has been zero extended. This phase has two bugs
and one limitations.

First, for the physical subregister used in pseudo insn COPY
like below, it permits incorrect optimization.
    %0:gpr32 = COPY $w0
    ...
    %4:gpr = MOV_32_64 %0:gpr32
    %5:gpr = SLL_ri %4:gpr(tied-def 0), 32
    %6:gpr = SRA_ri %5:gpr(tied-def 0), 32
The $w0 could be from the return value of a previous function call
and its upper 32-bit value might contain some non-zero values.
The same applies to function arguments.

Second, the current code may permits removing SLL/SRA like below:
    %0:gpr32 = COPY $w0
    %1:gpr32 = COPY %0:gpr32
    ...
    %4:gpr = MOV_32_64 %1:gpr32
    %5:gpr = SLL_ri %4:gpr(tied-def 0), 32
    %6:gpr = SRA_ri %5:gpr(tied-def 0), 32
The reason is that it did not follow def-use chain to skip all
intermediate 32bit-to-32bit COPY instructions.

The current implementation is also very conservative for PHI
instructions. If any PHI insn component is another PHI or COPY insn,
it will just permit SLL/SRA.

This patch fixed the issue as follows:
 - During def/use chain traversal, if any physical register is read,
   SLL/SRA will be preserved as these physical registers are mostly
   from function return values or current function arguments.
 - Recursively visit all COPY and PHI instructions.

4 years agoTemporarily Revert "[SLP] allow forming 2-way reduction patterns"
Eric Christopher [Wed, 20 Nov 2019 23:18:08 +0000 (15:18 -0800)]
Temporarily Revert "[SLP] allow forming 2-way reduction patterns"

After speaking with Sanjay - seeing a number of miscompiles and working
on tracking down a testcase. None of the follow on patches seem to
have helped so far.

This reverts commit 7ff57705ba196ce649d6034614b3b9df57e1f84f.

4 years ago[clang-tidy] modernize-use-equals-default avoid adding redundant semicolons
Mitchell Balan [Wed, 20 Nov 2019 20:36:45 +0000 (15:36 -0500)]
[clang-tidy] modernize-use-equals-default avoid adding redundant semicolons

Summary:
`modernize-use-equals-default` replaces default constructors/destructors with `= default;`. When the optional semicolon after a member function is present, this results in two consecutive semicolons.

This patch checks to see if the next non-comment token after the code to be replaced is a semicolon, and if so offers a replacement of `= default` rather than `= default;`.

This patch adds trailing comments and semicolons to about 5 existing tests.

Reviewers: malcolm.parsons, angelgarcia, aaron.ballman, alexfh

Patch by: poelmanc

Subscribers: MyDeveloperDay, JonasToth, cfe-commits

Tags: #clang

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

4 years ago[Support][Error] Unfriend FileError. It is not special.
Lang Hames [Wed, 20 Nov 2019 23:04:06 +0000 (15:04 -0800)]
[Support][Error] Unfriend FileError. It is not special.

FileError doesn't need direct access to Error's internals as it can access the
payload via handleErrors.

(ErrorList remains special: it is not possible to write a handler for it, due
to the special auto-unpacking treatment that it receives from handleErrors.)

4 years ago[AArch64] Add the pipeline model for Exynos M5
Evandro Menezes [Mon, 23 Sep 2019 17:59:25 +0000 (12:59 -0500)]
[AArch64] Add the pipeline model for Exynos M5

Add the scheduling and cost models for Exynos M5.

4 years ago[Reproducer] Limit signals to macro define sin <csignal>
Jonas Devlieghere [Wed, 20 Nov 2019 22:11:00 +0000 (14:11 -0800)]
[Reproducer] Limit signals to macro define sin <csignal>

SIGBUS is not part of the signal macros defined in the header <csignal>.

4 years agoHandle the case where the 'g' packet doesn't get all regs.
Jason Molenda [Wed, 20 Nov 2019 22:13:39 +0000 (14:13 -0800)]
Handle the case where the 'g' packet doesn't get all regs.
lldb would silently accept a response to the 'g' packet
(read all registers) which was too large; this handles the
case where it is too small.

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

<rdar://problem/34916465>

4 years agoCherry-pick gtest fix for asan tests.
Evgenii Stepanov [Fri, 15 Nov 2019 19:30:14 +0000 (11:30 -0800)]
Cherry-pick gtest fix for asan tests.

Summary:
https://github.com/google/googletest/commit/681454dae48f109abf68c424c9d2e6db9a092238

Clone+exec death test allocates a single page of stack to run chdir + exec on.
This is not enough when gtest is built with ASan and run on particular
hardware.

With ASan on x86_64, ExecDeathTestChildMain has frame size of 1728 bytes.

Call to chdir() in ExecDeathTestChildMain ends up in
_dl_runtime_resolve_xsavec, which attempts to save register state on the stack;
according to cpuid(0xd) XSAVE register save area size is 2568 on my machine.

This results in something like this in all death tests:
  Result: died but not with expected error.
  ...
  [  DEATH   ] AddressSanitizer:DEADLYSIGNAL
  [  DEATH   ] =================================================================
  [  DEATH   ] ==178637==ERROR: AddressSanitizer: stack-overflow on address ...

PiperOrigin-RevId: 278709790

Reviewers: pcc

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU][SILoadStoreOptimizer] Merge TBUFFER loads/stores
Piotr Sobczak [Wed, 20 Nov 2019 21:30:02 +0000 (22:30 +0100)]
[AMDGPU][SILoadStoreOptimizer] Merge TBUFFER loads/stores

Summary: Extend SILoadStoreOptimizer to merge tbuffer loads and stores.

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Driver] Fix missing space in lldb --help output.
Jonas Devlieghere [Wed, 20 Nov 2019 21:48:58 +0000 (13:48 -0800)]
[Driver] Fix missing space in lldb --help output.

4 years ago[Docs] Fix Sphinx warning (treated as error)
Jonas Devlieghere [Wed, 20 Nov 2019 21:46:37 +0000 (13:46 -0800)]
[Docs] Fix Sphinx warning (treated as error)

Fixes "undefined label" warning: if the link has no caption the label
must precede a section header.

4 years ago[clang][IFS] Driver Pipeline: generate stubs after standard pipeline (3)
Puyan Lotfi [Wed, 20 Nov 2019 19:41:11 +0000 (14:41 -0500)]
[clang][IFS] Driver Pipeline: generate stubs after standard pipeline (3)

Third Landing Attempt (dropping any linker invocation from clang driver):

Up until now, clang interface stubs has replaced the standard
PP -> C -> BE -> ASM -> LNK pipeline. With this change, it will happen in
conjunction with it. So what when you build your code you will get an
a.out or lib.so as well as an interface stub file.

Example:

clang -shared -o libfoo.so -emit-interface-stubs ...

will generate both a libfoo.so and a libfoo.ifso. The .so file will
contain the code from the standard compilation pipeline and the .ifso
file will contain the ELF stub library.

Note: For driver-test.c I've added -S in order to prevent any bot failures on
bots that don't have the proper linker for their native triple. You could always
specify a triple like x86_64-unknown-linux-gnu and on bots like x86_64-scei-ps4
the clang driver would invoke regular ld instead of getting the error
'Executable "orbis-ld" doesn't exist!' but on bots like ppc64be and s390x you'd
get an error "/usr/bin/ld: unrecognised emulation mode: elf_x86_64"

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

4 years ago[Reproducer] Generate LLDB reproducer on crash
Jonas Devlieghere [Wed, 20 Nov 2019 01:28:46 +0000 (17:28 -0800)]
[Reproducer] Generate LLDB reproducer on crash

This patch hooks the reproducer infrastructure with the signal handlers.
When lldb crashes with reproducers capture enabled, it will now generate
the reproducer and print a short message the standard out. This doesn't
affect the pretty stack traces, which are still printed before.

This patch also introduces a new reproducer sub-command that
intentionally raises a given signal to test the reproducer signal
handling.

Currently the signal handler is doing too much work. Instead of copying
over files into the reproducers in the signal handler, we should
re-invoke ourselves with a special command line flag that looks at the
VFS mapping and performs the copy.

This is a NO-OP when reproducers are disabled.

Differential revision: https://reviews.llvm.org/D70474

4 years ago[Hexagon] Fix two testcase errors
Krzysztof Parzyszek [Wed, 20 Nov 2019 21:04:41 +0000 (15:04 -0600)]
[Hexagon] Fix two testcase errors

This fixes issues discovered in https://reviews.llvm.org/D63973.

4 years ago[X86] Mark vector STRICT_FP_ROUND as Legal instead of Custom.
Craig Topper [Wed, 20 Nov 2019 21:01:29 +0000 (13:01 -0800)]
[X86] Mark vector STRICT_FP_ROUND as Legal instead of Custom.

The Custom handler doesn't do anything for these nodes anyway.

SelectionDAGISel won't mutate them if they are Legal or Custom.
X86 has custom code for mutating them due to missing isel patterns.
When the isel patterns are added Legal will be the right answer.
So go ahead a change it now since that's where we'll end up.

4 years agoMove widenable branch formation into makeGuardControlFlowExplicit helper
Philip Reames [Wed, 20 Nov 2019 20:51:37 +0000 (12:51 -0800)]
Move widenable branch formation into makeGuardControlFlowExplicit helper

This is mostly NFC, but I removed the setting of the guard's calling convention onto the WC call.  Why?  Because it was untested, and was producing an ill defined output as the declaration's convention wasn't been changed leaving a mismatch which is UB.

4 years ago[CMake] Fix the path to CrossWinToARMLinux.cmake CMake cache.
Vladimir Vereschaka [Wed, 20 Nov 2019 20:46:17 +0000 (12:46 -0800)]
[CMake] Fix the path to CrossWinToARMLinux.cmake CMake cache.

The comment was slightly misleading.

Behalf: broadwaylamb (Sergej Jaskiewicz)

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

4 years ago[AMDGPU] Fixed mfma test check. NFC.
Stanislav Mekhanoshin [Wed, 20 Nov 2019 20:27:20 +0000 (12:27 -0800)]
[AMDGPU] Fixed mfma test check. NFC.

4 years ago[lldb] Fix NSURL data formatter truncation issue
Davide Italiano [Wed, 20 Nov 2019 20:27:26 +0000 (12:27 -0800)]
[lldb] Fix NSURL data formatter truncation issue

Remove hardcoded string prefix length assumption causing issues when
concatenating summary for NSURL in NSURLSummaryProvider. Provider relies
on concatenation of NSStringProvider results for summary, and while the
strings are prefixed with '@' in Objective-C, that is not the case in
Swift causing part of the description to be truncated.

This will be tested in the downstream fork.

Patch by Martin Svensson!

4 years ago[lldb] [test] Un-XFAIL one lldb-server test on NetBSD
Michał Górny [Wed, 20 Nov 2019 20:16:34 +0000 (21:16 +0100)]
[lldb] [test] Un-XFAIL one lldb-server test on NetBSD

4 years ago[debugserver] Set arch based on TARGET_TRIPLE
Vedant Kumar [Wed, 20 Nov 2019 20:08:34 +0000 (12:08 -0800)]
[debugserver] Set arch based on TARGET_TRIPLE

Use TARGET_TRIPLE instead of LLVM_DEFAULT_TARGET_TRIPLE, as the latter
isn't exported by LLVMConfig.cmake, which means arch detection fails if
lldb is built separately from llvm.

4 years ago[AMDGPU] Keep consistent check of legal addressing mode.
Michael Liao [Tue, 19 Nov 2019 22:12:47 +0000 (17:12 -0500)]
[AMDGPU] Keep consistent check of legal addressing mode.

Summary:
- Add test cases for GFX10, which has narrower offset range compared to
  GFX9.

Reviewers: rampitec, arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix parser bug that permitted 'private' as a (no-op) decl-specifier even outside...
Richard Smith [Wed, 20 Nov 2019 19:58:34 +0000 (11:58 -0800)]
Fix parser bug that permitted 'private' as a (no-op) decl-specifier even outside OpenCL.

4 years agoRevert "[clangd] Fix a crash in expected types"
Nico Weber [Wed, 20 Nov 2019 19:38:35 +0000 (14:38 -0500)]
Revert "[clangd] Fix a crash in expected types"

This reverts commit b5135a86e04761577494c70e7c0057136cc90b5b.
Test fails on Windows.

4 years agoscudo: Only use the Android reserved TLS slot when building libc's copy of the allocator.
Peter Collingbourne [Tue, 19 Nov 2019 21:58:06 +0000 (13:58 -0800)]
scudo: Only use the Android reserved TLS slot when building libc's copy of the allocator.

When we're not building libc's allocator, just use a regular TLS variable. This
lets the unit tests pass on Android devices whose libc uses Scudo. Otherwise
libc's copy of Scudo and the unit tests' copy will both try to use the same
TLS slot, in likely incompatible ways.

This requires using ELF TLS, so start passing -fno-emulated-tls when building
the library and the unit tests on Android.

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

4 years ago[FileCollector] Ignore empty paths.
Jonas Devlieghere [Wed, 20 Nov 2019 18:38:55 +0000 (10:38 -0800)]
[FileCollector] Ignore empty paths.

Don't insert empty strings into the StringSet<> because that triggers an
assert in its implementation.

4 years ago[SystemZ] Avoid mixing strict and non-strict FP operations in tests
Ulrich Weigand [Wed, 20 Nov 2019 18:49:34 +0000 (19:49 +0100)]
[SystemZ] Avoid mixing strict and non-strict FP operations in tests

This is to prepare for having the IR verifier reject mixed functions.
Note that fp-strict-mul-02.ll and fp-strict-mul-04.ll still remain
to be fixed.

4 years ago[SelectionDAG][X86] Mutate strictFP nodes to non-strict in DoInstructionSelection...
Craig Topper [Wed, 20 Nov 2019 18:30:27 +0000 (10:30 -0800)]
[SelectionDAG][X86] Mutate strictFP nodes to non-strict in DoInstructionSelection when the node is marked Expand rather than when it is not Legal.

This allows operations that are marked Custom, but have some type
combinations that are legal to get past this code.

Add custom mutation code to X86's Select function for the nodes
that don't have isel patterns yet.