platform/upstream/llvm.git
5 years agoAMDGPU/InsertWaitcnt: Consistently use uint32_t for scores / time points
Nicolai Haehnle [Thu, 29 Nov 2018 11:06:21 +0000 (11:06 +0000)]
AMDGPU/InsertWaitcnt: Consistently use uint32_t for scores / time points

Summary:
There is one obsolete reference to using -1 as an indication of "unknown",
but this isn't actually used anywhere.

Using unsigned makes robust wrapping checks easier.

Reviewers: msearles, rampitec, scott.linder, kanarayan

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

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

llvm-svn: 347852

5 years agoAMDGPU/InsertWaitcnt: Remove unused WaitAtBeginning
Nicolai Haehnle [Thu, 29 Nov 2018 11:06:18 +0000 (11:06 +0000)]
AMDGPU/InsertWaitcnt: Remove unused WaitAtBeginning

Reviewers: msearles, rampitec, scott.linder, kanarayan

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

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

llvm-svn: 347851

5 years agoAMDGPU/InsertWaitcnts: Simplify pending events tracking
Nicolai Haehnle [Thu, 29 Nov 2018 11:06:14 +0000 (11:06 +0000)]
AMDGPU/InsertWaitcnts: Simplify pending events tracking

Summary:
Instead of storing the "score" (last time point) of the various relevant
events, only store whether an event is pending or not.

This is sufficient, because whenever only one event of a count type is
pending, its last time point is naturally the upper bound of all time
points of this count type, and when multiple event types are pending,
the count type has gone out of order and an s_waitcnt to 0 is required
to clear any pending event type (and will then clear all pending event
types for that count type).

This also removes the special handling of GDS_GPR_LOCK and EXP_GPR_LOCK.
I do not understand what this special handling ever attempted to achieve.
It has existed ever since the original port from an internal code base,
so my best guess is that it solved a problem related to EXEC handling in
that internal code base.

Reviewers: msearles, rampitec, scott.linder, kanarayan

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

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

llvm-svn: 347850

5 years agoAMDGPU/InsertWaitcnts: Use foreach loops for inst and wait event types
Nicolai Haehnle [Thu, 29 Nov 2018 11:06:11 +0000 (11:06 +0000)]
AMDGPU/InsertWaitcnts: Use foreach loops for inst and wait event types

Summary:
It hides the type casting ugliness, and I happened to have to add a new
such loop (in a later patch).

Reviewers: msearles, rampitec, scott.linder, kanarayan

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

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

llvm-svn: 347849

5 years agoAMDGPU/InsertWaitcnts: Untangle some semi-global state
Nicolai Haehnle [Thu, 29 Nov 2018 11:06:06 +0000 (11:06 +0000)]
AMDGPU/InsertWaitcnts: Untangle some semi-global state

Summary:
Reduce the statefulness of the algorithm in two ways:

1. More clearly split generateWaitcntInstBefore into two phases: the
   first one which determines the required wait, if any, without changing
   the ScoreBrackets, and the second one which actually inserts the wait
   and updates the brackets.

2. Communicate pre-existing s_waitcnt instructions using an argument to
   generateWaitcntInstBefore instead of through the ScoreBrackets.

To simplify these changes, a Waitcnt structure is introduced which carries
the counts of an s_waitcnt instruction in decoded form.

There are some functional changes:

1. The FIXME for the VCCZ bug workaround was implemented: we only wait for
   SMEM instructions as required instead of waiting on all counters.

2. We now properly track pre-existing waitcnt's in all cases, which leads
   to less conservative waitcnts being emitted in some cases.

     s_load_dword ...
     s_waitcnt lgkmcnt(0)    <-- pre-existing wait count
     ds_read_b32 v0, ...
     ds_read_b32 v1, ...
     s_waitcnt lgkmcnt(0)    <-- this is too conservative
     use(v0)
     more code
     use(v1)

   This increases code size a bit, but the reduced latency should still be a
   win in basically all cases. The worst code size regressions in my shader-db
   are:

 WORST REGRESSIONS - Code Size
 Before After     Delta Percentage
   1724  1736        12    0.70 %   shaders/private/f1-2015/1334.shader_test [0]
   2276  2284         8    0.35 %   shaders/private/f1-2015/1306.shader_test [0]
   4632  4640         8    0.17 %   shaders/private/ue4_elemental/62.shader_test [0]
   2376  2384         8    0.34 %   shaders/private/f1-2015/1308.shader_test [0]
   3284  3292         8    0.24 %   shaders/private/talos_principle/1955.shader_test [0]

Reviewers: msearles, rampitec, scott.linder, kanarayan

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

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

llvm-svn: 347848

5 years ago[CODE_OWNERS] Add myself as code owner for MinGW
Martin Storsjo [Thu, 29 Nov 2018 10:58:15 +0000 (10:58 +0000)]
[CODE_OWNERS] Add myself as code owner for MinGW

llvm-svn: 347847

5 years agoRemove getopt includes from the driver
Pavel Labath [Thu, 29 Nov 2018 10:45:41 +0000 (10:45 +0000)]
Remove getopt includes from the driver

They are not needed now that we use LLVMOption for command-line parsing
thank you, Jonas).  This also allows us to avoid linking of lldbHost
into the driver which was breaking liblldb encapsulation.

(Technically, there is still a lldb/Host/windows/windows.h include which
is needed on windows, but this is a header-only wrapper for <windows.h>,
so it is not necessary to link lldbHost for that. But ideally, that
should go away too.)

llvm-svn: 347846

5 years ago[NFC] Add two XFAIL tests from PR39783
Max Kazantsev [Thu, 29 Nov 2018 09:38:22 +0000 (09:38 +0000)]
[NFC] Add two XFAIL tests from PR39783

llvm-svn: 347845

5 years agoDisable TermFolding in LoopSimplifyCFG until PR39783 is fixed
Max Kazantsev [Thu, 29 Nov 2018 09:00:19 +0000 (09:00 +0000)]
Disable TermFolding in LoopSimplifyCFG until PR39783 is fixed

llvm-svn: 347844

5 years ago[LoopStrengthReduce] ComplexityLimit as an option
Sam Parker [Thu, 29 Nov 2018 08:34:22 +0000 (08:34 +0000)]
[LoopStrengthReduce] ComplexityLimit as an option

Convert ComplexityLimit into a command line value.

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

llvm-svn: 347843

5 years ago[LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for...
George Rimar [Thu, 29 Nov 2018 08:16:07 +0000 (08:16 +0000)]
[LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

The issue happens because starting from DWARF v5
DW_AT_addr_base attribute should be used
instead of DW_AT_GNU_addr_base. LLDB does not do that and
we end up reading the .debug_addr header as section content
(as addresses) instead of skipping it and reading the real addresses.
Then LLDB is unable to match 2 similar locations and
thinks they are different.

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

llvm-svn: 347842

5 years ago[Inliner] Modify the merging of min-legal-vector-width attribute to better handle...
Craig Topper [Thu, 29 Nov 2018 07:27:38 +0000 (07:27 +0000)]
[Inliner] Modify the merging of min-legal-vector-width attribute to better handle when the caller or callee don't have the attribute.

Lack of an attribute means that the function hasn't been checked for what vector width it requires. So if the caller or the callee doesn't have the attribute we should make sure the combined function after inlining does not have the attribute.

If the caller already doesn't have the attribute we can just avoid adding it. Otherwise if the callee doesn't have the attribute just remove the caller's attribute.

llvm-svn: 347841

5 years ago[Inliner] Add test for merging of min-legal-vector-width function attribute.
Craig Topper [Thu, 29 Nov 2018 07:02:47 +0000 (07:02 +0000)]
[Inliner] Add test for merging of min-legal-vector-width function attribute.

This should have been added in r337844, but apparently was I failed to 'git add' the file.

llvm-svn: 347840

5 years ago[CGP] Improve compile time for complex addressing mode
Serguei Katkov [Thu, 29 Nov 2018 06:45:18 +0000 (06:45 +0000)]
[CGP] Improve compile time for complex addressing mode

This is a fix for PR39625 with improvement the compile time
by reducing the number of intermediate Phi nodes created.

Reviewers: john.brawn, reames
Reviewed By: john.brawn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54932

llvm-svn: 347839

5 years agoRevert "[TextAPI] Fix a memory leak in the TBD reader."
Juergen Ributzka [Thu, 29 Nov 2018 06:32:49 +0000 (06:32 +0000)]
Revert "[TextAPI] Fix a memory leak in the TBD reader."

llvm-svn: 347838

5 years ago[TextAPI] Fix a memory leak in the TBD reader.
Juergen Ributzka [Thu, 29 Nov 2018 06:16:33 +0000 (06:16 +0000)]
[TextAPI] Fix a memory leak in the TBD reader.

This fixes an issue where we were leaking the YAML document if there was a
parsing error.

llvm-svn: 347837

5 years ago[TextAPI] Switch back to a custom Platform enum.
Juergen Ributzka [Thu, 29 Nov 2018 05:56:03 +0000 (05:56 +0000)]
[TextAPI] Switch back to a custom Platform enum.

Moving to PlatformType from BinaryFormat had some UB fallout when handing
unknown platforms or malformed input files.

This should fix the sanitizer bots.

llvm-svn: 347836

5 years ago[X86] Correct comment. NFC
Craig Topper [Thu, 29 Nov 2018 05:56:03 +0000 (05:56 +0000)]
[X86] Correct comment. NFC

llvm-svn: 347835

5 years agoAdd Hurd target to Clang driver (2/2)
Kristina Brooks [Thu, 29 Nov 2018 03:49:14 +0000 (03:49 +0000)]
Add Hurd target to Clang driver (2/2)

This adds Hurd toolchain support to Clang's driver in addition
to handling translating the triple from Hurd-compatible form to
the actual triple registered in LLVM.

(Phabricator was stripping the empty files from the patch so I
manually created them)

Patch by sthibaul (Samuel Thibault)

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

llvm-svn: 347833

5 years agoAdd Hurd target to LLVMSupport (1/2)
Kristina Brooks [Thu, 29 Nov 2018 03:23:01 +0000 (03:23 +0000)]
Add Hurd target to LLVMSupport (1/2)

Add the required target triples to LLVMSupport to support Hurd
in LLVM (formally `pc-hurd-gnu`).

Patch by sthibaul (Samuel Thibault)

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

llvm-svn: 347832

5 years ago[PowerPC] Fix a conversion is not considered when the ISD::BR_CC node making the...
Li Jia He [Thu, 29 Nov 2018 03:04:39 +0000 (03:04 +0000)]
[PowerPC] Fix a conversion is not considered when the ISD::BR_CC node making the instruction selection

Summary:
 A signed comparison of i1 values produces the opposite result to an unsigned one if the condition code
 includes less-than or greater-than. This is so because 1 is the most negative signed i1 number and the
 most positive unsigned i1 number. The CR-logical operations used for such comparisons are non-commutative
 so for signed comparisons vs. unsigned ones, the input operands just need to be swapped.

Reviewed By: steven.zhang

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

llvm-svn: 347831

5 years ago[WebAssembly] Update docs
Sam Clegg [Thu, 29 Nov 2018 02:55:25 +0000 (02:55 +0000)]
[WebAssembly] Update docs

This is an reland of rL343155 which got reverted because
of a sphinx failure on the buildbot.

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

llvm-svn: 347830

5 years ago[PowerPC] [NFC] Add test cases to the ISD::BR_CC node in the instruction selection
Li Jia He [Thu, 29 Nov 2018 02:51:03 +0000 (02:51 +0000)]
[PowerPC] [NFC] Add test cases to the ISD::BR_CC node in the instruction selection
Add the following test case for the ISD::BR_CC node in the instruction selection
define i64 @testi64slt(i64 %c1, i64 %c2, i64 %c3, i64 %c4, i64 %a1, i64 %a2) #0 {
entry:
  %cmp1 = icmp eq i64 %c3, %c4
  %cmp3tmp = icmp eq i64 %c1, %c2
  %cmp3 = icmp slt i1 %cmp3tmp, %cmp1
  br i1 %cmp3, label %iftrue, label %iffalse
iftrue:
  ret i64 %a1
iffalse:
  ret i64 %a2
}
The data type i64 can be replaced by i32, i64, float, double

And condition codes can be replaced by: SETEQ, SETEN, SELT, SETLE, SETGT, SETGE,SETULT, SETULE, SSETGT, and SETUGE

Reviewed By: steven.zhang

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

llvm-svn: 347828

5 years ago[TextAPI] TBD Reader/Writer (bot fixes: take 2)
Juergen Ributzka [Thu, 29 Nov 2018 02:28:58 +0000 (02:28 +0000)]
[TextAPI] TBD Reader/Writer (bot fixes: take 2)

Replace the tuple with a struct to work around an explicit constructor bug.

llvm-svn: 347827

5 years agoNFC. Use unsigned type for uses counter in CaptureTracking
Artur Pilipenko [Thu, 29 Nov 2018 02:15:35 +0000 (02:15 +0000)]
NFC. Use unsigned type for uses counter in CaptureTracking

llvm-svn: 347826

5 years ago[Documentation] Try to fix build failure in cppcoreguidelines-narrowing-conversions...
Eugene Zelenko [Thu, 29 Nov 2018 02:13:25 +0000 (02:13 +0000)]
[Documentation] Try to fix build failure in cppcoreguidelines-narrowing-conversions documentation

llvm-svn: 347825

5 years ago[TextAPI] TBD Reader/Writer (bot fixes)
Juergen Ributzka [Thu, 29 Nov 2018 01:55:57 +0000 (01:55 +0000)]
[TextAPI] TBD Reader/Writer (bot fixes)

Trying if switching from a vector to an array will appeas the bots.

llvm-svn: 347824

5 years ago[TextAPI] TBD Reader/Writer
Juergen Ributzka [Thu, 29 Nov 2018 01:20:46 +0000 (01:20 +0000)]
[TextAPI] TBD Reader/Writer

Add basic infrastructure for reading and writting TBD files (version 1 - 3).

The TextAPI library is not used by anything yet (besides the unit tests). Tool
support will be added in a separate commit.

The TBD format is currently documented in the implementation file (TextStub.cpp).

https://reviews.llvm.org/D53945

Update: This contains changes to fix issues discovered by the bots:
 - add parentheses to silence warnings.
 - rename variables
 - use PlatformType from BinaryFormat
llvm-svn: 347823

5 years ago[driver] Fix --core/-c and add test
Jonas Devlieghere [Thu, 29 Nov 2018 00:22:28 +0000 (00:22 +0000)]
[driver] Fix --core/-c and add test

Because the optarg variable was shadowed we didn't notice we weren't
extracting the value from the option. This patch fixes that and renames
the variable to prevent this from happening in the future.

I also added two tests to check the error output for --core and --file
when the given value doesn't exist.

llvm-svn: 347821

5 years ago[ELF] --gdb-index: use lower_bound to compute relative CU index in the object file
Fangrui Song [Thu, 29 Nov 2018 00:17:00 +0000 (00:17 +0000)]
[ELF] --gdb-index: use lower_bound to compute relative CU index in the object file

Summary:
This reinstates what I originally intended to do in D54361.
It removes the assumption that .debug_gnu_pubnames has increasing CuOffset.

Now we do better than gold here: when .debug_gnu_pubnames contains
multiple sets, gold would think every set has the same CU index as the
first set (incorrect).

Reviewed By: ruiu

Reviewers: ruiu, dblaikie, espindola

Subscribers: emaste, arichardson, arphaman, llvm-commits

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

llvm-svn: 347820

5 years ago[x86] try select simplification for target-specific nodes
Sanjay Patel [Wed, 28 Nov 2018 22:51:04 +0000 (22:51 +0000)]
[x86] try select simplification for target-specific nodes

This failed to select (which might be a separate bug) in
X86ISelDAGToDAG because we try to create a select node
that can be simplified away after rL347227.

This change avoids the problem by simplifying the SHRUNKBLEND
node sooner. In the test case, we manage to realize that the
true/false values of the select (SHRUNKBLEND) are the same thing,
so it simplifies away completely.

llvm-svn: 347818

5 years ago[driver] Some NFC cleanup
Jonas Devlieghere [Wed, 28 Nov 2018 22:39:17 +0000 (22:39 +0000)]
[driver] Some NFC cleanup

This patch includes some small things I noticed while refactoring the
driver but didn't want to include in that patch.

llvm-svn: 347817

5 years agoRevert "Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. "
Eric Fiselier [Wed, 28 Nov 2018 22:24:19 +0000 (22:24 +0000)]
Revert "Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. "

This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12.

The tests were failing on 32 bit builds, and I don't have time
to clean them up right now. I'll recommit tomorrow with fixed tests.

llvm-svn: 347816

5 years agoEnsure that test clang-tidy/export-relpath.cpp works with Windows path separators.
Matthew Voss [Wed, 28 Nov 2018 22:16:18 +0000 (22:16 +0000)]
Ensure that test clang-tidy/export-relpath.cpp works with Windows path separators.

llvm-svn: 347815

5 years agoMake standalone build find tabelgen
Jonas Devlieghere [Wed, 28 Nov 2018 22:10:01 +0000 (22:10 +0000)]
Make standalone build find tabelgen

The standalone build couldn't find tablegen because we didn't include
it. This patch rectifies that.

llvm-svn: 347814

5 years ago[lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for objc_except...
Kuba Mracek [Wed, 28 Nov 2018 22:01:52 +0000 (22:01 +0000)]
[lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for objc_exception_throw for Obj-C runtimes

This adds new APIs and a command to deal with exceptions (mostly Obj-C exceptions): SBThread and Thread get GetCurrentException API, which returns an SBValue/ValueObjectSP with the current exception for a thread. "Current" means an exception that is currently being thrown, caught or otherwise processed. In this patch, we only know about the exception when in objc_exception_throw, but subsequent patches will expand this (and add GetCurrentExceptionBacktrace, which will return an SBThread/ThreadSP containing a historical thread backtrace retrieved from the exception object. Currently unimplemented, subsequent patches will implement this).

Extracting the exception from objc_exception_throw is implemented by adding a frame recognizer.

This also add a new sub-command "thread exception", which prints the current exception.

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

llvm-svn: 347813

5 years agoAllow cpu-dispatch forward declarations.
Erich Keane [Wed, 28 Nov 2018 21:54:04 +0000 (21:54 +0000)]
Allow cpu-dispatch forward declarations.

As a followup to r347805, allow forward declarations of cpu-dispatch and
cpu-specific for the same reasons.

Change-Id: Ic1bde9be369b1f8f1d47d58e6fbdc2f9dfcdd785
llvm-svn: 347812

5 years agoEnsure sanitizer check function calls have a !dbg location
Adrian Prantl [Wed, 28 Nov 2018 21:44:06 +0000 (21:44 +0000)]
Ensure sanitizer check function calls have a !dbg location

Function calls without a !dbg location inside a function that has a
DISubprogram make it impossible to construct inline information and
are rejected by the verifier. This patch ensures that sanitizer check
function calls have a !dbg location, by carrying forward the location
of the preceding instruction or by inserting an artificial location if
necessary.

This fixes a crash when compiling the attached testcase with -Os.

rdar://problem/45311226

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

Note: This reapllies r344915, modified to reuse the IRBuilder's
DebugLoc if one exists instead of picking the one from CGDebugInfo
since the latter may get reset when emitting thunks such as block
helpers in the middle of emitting another function.

llvm-svn: 347810

5 years agoRevert "[TextAPI] TBD Reader/Writer"
Juergen Ributzka [Wed, 28 Nov 2018 21:38:28 +0000 (21:38 +0000)]
Revert "[TextAPI] TBD Reader/Writer"

Reverting to unbreak bots.

llvm-svn: 347809

5 years ago[TextAPI] TBD Reader/Writer
Juergen Ributzka [Wed, 28 Nov 2018 21:27:00 +0000 (21:27 +0000)]
[TextAPI] TBD Reader/Writer

Add basic infrastructure for reading and writting TBD files (version 1 - 3).

The TextAPI library is not used by anything yet (besides the unit tests). Tool
support will be added in a separate commit.

The TBD format is currently documented in the implementation file (TextStub.cpp).

https://reviews.llvm.org/D53945

llvm-svn: 347808

5 years ago[DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.
Paul Robinson [Wed, 28 Nov 2018 21:18:07 +0000 (21:18 +0000)]
[DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.

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

llvm-svn: 347807

5 years ago[DebugInfo] IR/Bitcode changes for DISubprogram flags.
Paul Robinson [Wed, 28 Nov 2018 21:14:32 +0000 (21:14 +0000)]
[DebugInfo] IR/Bitcode changes for DISubprogram flags.

Packing the flags into one bitcode word will save effort in
adding new flags in the future.

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

llvm-svn: 347806

5 years agoCorrect 'target' default behavior on redecl, allow forward declaration.
Erich Keane [Wed, 28 Nov 2018 20:58:43 +0000 (20:58 +0000)]
Correct 'target' default behavior on redecl, allow forward declaration.

Declarations without the attribute were disallowed because it would be
ambiguous which 'target' it was supposed to be on.  For example:

void ___attribute__((target("v1"))) foo();
void foo(); // Redecl of above, or fwd decl of below?
void ___attribute__((target("v2"))) foo();

However, a first declaration doesn't have that problem, and erroring
prevents it from working in cases where the forward declaration is
useful.

Additionally, a forward declaration of target==default wouldn't properly
cause multiversioning, so this patch fixes that.

The patch was not split since the 'default' fix would require
implementing the same check for that case, followed by undoing the same
change for the fwd-decl implementation.

Change-Id: I66f2c5bc2477bcd3f7544b9c16c83ece257077b0
llvm-svn: 347805

5 years ago[Coverage] Specify the Itanium ABI triple for a C++ test
Vedant Kumar [Wed, 28 Nov 2018 20:51:09 +0000 (20:51 +0000)]
[Coverage] Specify the Itanium ABI triple for a C++ test

llvm-svn: 347804

5 years ago[Coverage] Do not visit artificial stmts in defaulted methods (PR39822)
Vedant Kumar [Wed, 28 Nov 2018 20:48:07 +0000 (20:48 +0000)]
[Coverage] Do not visit artificial stmts in defaulted methods (PR39822)

There is no reason to emit coverage mappings for artificial statements
contained within defaulted methods, as these statements are not visible
to users.

Only emit a mapping for the body of the defaulted method (clang treats
the text of the "default" keyword as the body when reporting locations).
This allows users to see how often the default method is called, but
trims down the coverage mapping by skipping visitation of the children
of the method.

The immediate motivation for this change is that the lexer's
getPreciseTokenLocEnd API cannot return the correct location when given
an artificial statement (with a somewhat made-up location) as an input.

Test by Orivej Desh!

Fixes llvm.org/PR39822.

llvm-svn: 347803

5 years ago[OpenMP] Rename ompt_mutex_impl_unknown to ompt_mutex_impl_none
Jonathan Peyton [Wed, 28 Nov 2018 20:19:53 +0000 (20:19 +0000)]
[OpenMP] Rename ompt_mutex_impl_unknown to ompt_mutex_impl_none

This change renames ompt_mutex_impl_unknown to ompt_mutex_impl_none,
following the name change in the specification.

Patch by Hansang Bae

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

llvm-svn: 347802

5 years ago[OpenMP] Minor cleanup of debug code
Jonathan Peyton [Wed, 28 Nov 2018 20:18:06 +0000 (20:18 +0000)]
[OpenMP] Minor cleanup of debug code

* Fix calculation of string length.
* Remove NULL-check of pointer which has been dereferenced.

Patch by Andrey Churbanov

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

llvm-svn: 347801

5 years ago[OpenMP] Fixed possible array out of bound access
Jonathan Peyton [Wed, 28 Nov 2018 20:15:11 +0000 (20:15 +0000)]
[OpenMP] Fixed possible array out of bound access

There is low probability that array th_hot_teams can be
accessed out of bound (when many nested levels are requested
to keep hot teams via KMP_HOT_TEAMS_MAX_LEVEL). The patch
adds the check of index that fixes the problem.

Patch by Andrey Churbanov

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

llvm-svn: 347800

5 years ago[OpenMP] Add omp_get_device_num() and update several other device API functions
Jonathan Peyton [Wed, 28 Nov 2018 20:10:26 +0000 (20:10 +0000)]
[OpenMP] Add omp_get_device_num() and update several other device API functions

Add omp_get_device_num() function for 5.0 which returns the number of the device
the current thread is running on. Also, did some cleanup and updating of device
API functions to make them into weak functions that should be replaced with
libomptarget functions when libomptarget is present.

Patch by Terry Wilmarth

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

llvm-svn: 347799

5 years ago[unittests] Fix the File System Test on Windows
Stella Stamenova [Wed, 28 Nov 2018 19:34:01 +0000 (19:34 +0000)]
[unittests] Fix the File System Test on Windows

Two of the file system tests are failing on Windows - this updates them to expect the correct values after the refactor of the file system code.

llvm-svn: 347796

5 years agoReapply "[llvm-mca] Return the total number of cycles from method Pipeline::run()."
Andrea Di Biagio [Wed, 28 Nov 2018 19:31:19 +0000 (19:31 +0000)]
Reapply "[llvm-mca] Return the total number of cycles from method Pipeline::run()."

This reapplies r347767 (originally reviewed at: https://reviews.llvm.org/D55000)
with a fix for the missing std::move of the Error returned by the call to
Pipeline::runCycle().

Below is the original commit message from r347767.

If a user only cares about the overall latency, then the best/quickest way is to
change method Pipeline::run() so that it returns the total number of cycles to
the caller.

When the simulation pipeline is run, the number of cycles (or an error) is
returned from method Pipeline::run().
The advantage is that no hardware event listener is needed for computing that
latency. So, the whole process should be faster (and simpler - at least for that
particular use case).

llvm-svn: 347795

5 years agoRevert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."
Davide Italiano [Wed, 28 Nov 2018 19:15:23 +0000 (19:15 +0000)]
Revert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."

This broke the lldb bots.

llvm-svn: 347794

5 years ago[OPENMP]Fix emission of the target regions in virtual functions.
Alexey Bataev [Wed, 28 Nov 2018 19:00:07 +0000 (19:00 +0000)]
[OPENMP]Fix emission of the target regions in virtual functions.

Fixed emission of the target regions found in the virtual functions.
Previously we may end up with the situation when those regions could be
skipped.

llvm-svn: 347793

5 years agoRevert "[clang-tools-extra] r347753 - [clangd] Build and test IndexBenchmark in check...
Matthew Voss [Wed, 28 Nov 2018 18:48:32 +0000 (18:48 +0000)]
Revert "[clang-tools-extra] r347753 - [clangd] Build and test IndexBenchmark in check-clangd"

This revision was causing failures on the buildbots, and our internal CI.

See: http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20856
llvm-svn: 347792

5 years ago[NFC] Move MultIversioning::Type into Decl so that it can be used in
Erich Keane [Wed, 28 Nov 2018 18:34:14 +0000 (18:34 +0000)]
[NFC] Move MultIversioning::Type into Decl so that it can be used in
CodeGen

Change-Id: I32b14edca3501277e0e65672eafe3eea38c6f9ae
llvm-svn: 347791

5 years agoFix bad _LIBCPP_ALIGNOF test
Eric Fiselier [Wed, 28 Nov 2018 18:32:16 +0000 (18:32 +0000)]
Fix bad _LIBCPP_ALIGNOF test

llvm-svn: 347790

5 years agoImplement P0966 - string::reserve should not shrink
Marshall Clow [Wed, 28 Nov 2018 18:18:34 +0000 (18:18 +0000)]
Implement P0966 - string::reserve should not shrink

llvm-svn: 347789

5 years ago(no commit message)
Julian Lettner [Wed, 28 Nov 2018 18:17:23 +0000 (18:17 +0000)]
(no commit message)

llvm-svn: 347788

5 years agoMove internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.
Eric Fiselier [Wed, 28 Nov 2018 18:16:02 +0000 (18:16 +0000)]
Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`.

Summary:
Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See  llvm.org/PR39713

This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used.

This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement.

I think we should commit this change immediately, and decide what we want to do about the ABI afterwards.

Reviewers: ldionne, EricWF

Reviewed By: EricWF

Subscribers: christof, libcxx-commits

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

llvm-svn: 347787

5 years ago[X86] Make X86TTIImpl::getCastInstrCost properly handle the case where AVX512 is...
Craig Topper [Wed, 28 Nov 2018 18:11:42 +0000 (18:11 +0000)]
[X86] Make X86TTIImpl::getCastInstrCost properly handle the case where AVX512 is enabled, but 512-bit vectors aren't legal.

Unlike most cost model functions this code makes a lot of table lookups without using the results from getTypeLegalizationCost. This means 512-bit vectors can be looked up even when the type isn't legal.

This patch adds a check around the two tables that contain 512-bit types to make sure that neither of the types would be split by type legalization. Meaning 512 bit types are illegal. I wanted to write this in a somewhat generic way that uses type legalization query hooks. But if prefered, I can switch to just using is512BitVector and the subtarget feature.

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

llvm-svn: 347786

5 years ago[X86] Add some cost model entries for sext/zext for avx512bw
Craig Topper [Wed, 28 Nov 2018 18:11:39 +0000 (18:11 +0000)]
[X86] Add some cost model entries for sext/zext for avx512bw

This fixes some of scalarization costs reported for sext/zext using avx512bw. This does not fix all scalarization costs being reported. Just the worst.

I've restricted this only to combinations of types that are legal with avx512bw like v32i1/v64i1/v32i16/v64i8 and conversions between vXi1 and vXi8/vXi16 with legal vXi8/vXi16 result types.

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

llvm-svn: 347785

5 years ago[X86] Add a combine for back to back VSRAI instructions
Craig Topper [Wed, 28 Nov 2018 18:03:38 +0000 (18:03 +0000)]
[X86] Add a combine for back to back VSRAI instructions

Expansion of SIGN_EXTEND_INREG can create a VSRAI instruction. If there is already a VSRAI after it, we should combine them into a larger VSRAI

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

llvm-svn: 347784

5 years ago[libcxx] Remove dynarray
Louis Dionne [Wed, 28 Nov 2018 18:02:00 +0000 (18:02 +0000)]
[libcxx] Remove dynarray

Summary:
std::dynarray had been proposed for C++14, but it was pulled out from C++14
and there are no plans to standardize it anymore.

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, arphaman, libcxx-commits

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

llvm-svn: 347783

5 years ago[DebugInfo] Give inlinable calls DILocs (PR39807)
Jeremy Morse [Wed, 28 Nov 2018 17:58:45 +0000 (17:58 +0000)]
[DebugInfo] Give inlinable calls DILocs (PR39807)

In PR39807 we incorrectly handle circumstances where calls are common'd
from conditional blocks into the parent BB. Calls that can be inlined
must always have DebugLocs, however we strip them during commoning, which
the IR verifier asserts on.

Fix this by using applyMergedLocation: it will perform the same DebugLoc
stripping of conditional Locs, but will also generate an unknown location
DebugLoc that satisfies the requirement for inlinable calls to always have
locations.

Some of the prior logic for selecting a DebugLoc is now likely redundant;
I'll generate a follow-up to remove it (involves editing more regression
tests).

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

llvm-svn: 347782

5 years agoSimplify Symbol::getPltVA.
Rui Ueyama [Wed, 28 Nov 2018 17:42:59 +0000 (17:42 +0000)]
Simplify Symbol::getPltVA.

This patch also makes getPltEntryOffset a non-member function because
it doesn't depend on any private members of the TargetInfo class.

I tried a few different ideas, and it seems this change fits in best to me.

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

llvm-svn: 347781

5 years ago[libcxx] Use clang-verify in the lit test suite even when availability is enabled
Louis Dionne [Wed, 28 Nov 2018 17:31:17 +0000 (17:31 +0000)]
[libcxx] Use clang-verify in the lit test suite even when availability is enabled

llvm-svn: 347780

5 years ago[gcov] Disable instrprof-gcov-fork.test.
Matt Morehouse [Wed, 28 Nov 2018 17:24:07 +0000 (17:24 +0000)]
[gcov] Disable instrprof-gcov-fork.test.

Test has been flaky for over a week and author hasn't fixed.

llvm-svn: 347779

5 years ago[LICM] Enable control flow hoisting by default
John Brawn [Wed, 28 Nov 2018 17:23:03 +0000 (17:23 +0000)]
[LICM] Enable control flow hoisting by default

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

llvm-svn: 347778

5 years ago[analyzer] Cleanup constructors in the Z3 backend
Mikhail R. Gadelha [Wed, 28 Nov 2018 17:22:49 +0000 (17:22 +0000)]
[analyzer] Cleanup constructors in the Z3 backend

Summary: Left only the constructors that are actually required, and marked the move constructors as deleted. They are not used anymore and we were never sure they've actually worked correctly.

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, Szelethus, donat.nagy, dkrupp

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

llvm-svn: 347777

5 years ago[LICM] Reapply r347190 "Make LICM able to hoist phis" with fix
John Brawn [Wed, 28 Nov 2018 17:21:49 +0000 (17:21 +0000)]
[LICM] Reapply r347190 "Make LICM able to hoist phis" with fix

This commit caused failures because it failed to correctly handle cases where
we hoist a phi, then hoist a use of that phi, then have to rehoist that use. We
need to make sure that we rehoist the use to _after_ the hoisted phi, which we
do by always rehoisting to the immediate dominator instead of just rehoisting
everything to the original preheader.

An option is also added to control whether control flow is hoisted, which is
off in this commit but will be turned on in a subsequent commit.

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

llvm-svn: 347776

5 years agoRevert [llvm-mca] Return the total number of cycles from method Pipeline::run().
Andrea Di Biagio [Wed, 28 Nov 2018 16:39:48 +0000 (16:39 +0000)]
Revert [llvm-mca] Return the total number of cycles from method Pipeline::run().

This reverts commits 347767.

llvm-svn: 347775

5 years ago[RISCV] Support .option push and .option pop
Alex Bradbury [Wed, 28 Nov 2018 16:39:14 +0000 (16:39 +0000)]
[RISCV] Support .option push and .option pop

This adds support in the RISCVAsmParser the storing of Subtarget feature bits to a stack so that they can be pushed/popped to enable/disable multiple features at once.

Differential Revision: https://reviews.llvm.org/D46424
Patch by Lewis Revill.

llvm-svn: 347774

5 years ago[InstCombine] Combine saturating add/sub with constant operands
Nikita Popov [Wed, 28 Nov 2018 16:37:15 +0000 (16:37 +0000)]
[InstCombine] Combine saturating add/sub with constant operands

Combine
  sat(sat(X + C1) + C2) -> sat(X + (C1+C2))
and
  sat(sat(X - C1) - C2) -> sat(X - (C1+C2))
if the sign of C1 and C2 matches.

In the unsigned case we can compute C1+C2 with saturating arithmetic,
and InstSimplify will reduce this just to the saturation value. For
the signed case, we cannot perform the simplification if the result
of the addition overflows.

This change is part of https://reviews.llvm.org/D54534.

llvm-svn: 347773

5 years ago[InstCombine] Canonicalize ssub.sat to sadd.sat
Nikita Popov [Wed, 28 Nov 2018 16:37:09 +0000 (16:37 +0000)]
[InstCombine] Canonicalize ssub.sat to sadd.sat

Canonicalize ssub.sat(X, C) to ssub.sat(X, -C) if C is constant and
not signed minimum. This will help further optimizations to apply.

This change is part of https://reviews.llvm.org/D54534.

llvm-svn: 347772

5 years ago[ValueTracking] Determine always-overflow condition for unsigned sub
Nikita Popov [Wed, 28 Nov 2018 16:37:04 +0000 (16:37 +0000)]
[ValueTracking] Determine always-overflow condition for unsigned sub

Always-overflow was already determined for unsigned addition, but
not subtraction. This patch establishes parity.

This allows us to perform some additional simplifications for
signed saturating subtractions.

This change is part of https://reviews.llvm.org/D54534.

llvm-svn: 347771

5 years ago[InstCombine] Use known overflow information for saturating add/sub
Nikita Popov [Wed, 28 Nov 2018 16:36:59 +0000 (16:36 +0000)]
[InstCombine] Use known overflow information for saturating add/sub

If ValueTracking can determine that the add/sub can newer overflow,
replace it with the corresponding nuw/nsw add/sub.

Additionally, for the unsigned case, if ValueTracking determines
that the add/sub always overflows, replace the result with the
saturation value.

This change is part of https://reviews.llvm.org/D54534.

llvm-svn: 347770

5 years ago[InstCombine] Canonicalize const arg for saturating adds
Nikita Popov [Wed, 28 Nov 2018 16:36:52 +0000 (16:36 +0000)]
[InstCombine] Canonicalize const arg for saturating adds

If a saturating add intrinsic has one constant argument, make sure
it is on the RHS. This will simplify further transformations.

This change is part of https://reviews.llvm.org/D54534.

llvm-svn: 347769

5 years ago[Hexagon] Add missing flags to ELF YAMLIO
Krzysztof Parzyszek [Wed, 28 Nov 2018 16:25:47 +0000 (16:25 +0000)]
[Hexagon] Add missing flags to ELF YAMLIO

llvm-svn: 347768

5 years ago[llvm-mca] Return the total number of cycles from method Pipeline::run().
Andrea Di Biagio [Wed, 28 Nov 2018 16:24:51 +0000 (16:24 +0000)]
[llvm-mca] Return the total number of cycles from method Pipeline::run().

If a user only cares about the overall latency, then the best/quickest way is to
change method Pipeline::run() so that it returns the total number of cycles to
the caller.

When the simulation pipeline is run, the number of cycles (or an error) is
returned from method Pipeline::run().
The advantage is that no hardware event listener is needed for computing that
latency. So, the whole process should be faster (and simpler - at least for that
particular use case).

llvm-svn: 347767

5 years agollvm-git: More tweaks.
James Y Knight [Wed, 28 Nov 2018 15:30:39 +0000 (15:30 +0000)]
llvm-git: More tweaks.

On python3, use bytes for reading and applying the patch file, rather
than str. This fixes encoding issues when applying patches with
python3.X (reported by zturner).

Also, simplify and speed up "svn update" via svn's "--parents"
argument, instead of manually computing and supplying the list of
parent directories to update.

llvm-svn: 347766

5 years ago[libcxx] Apply _LIBCPP_INLINE_VISIBILITY for std::hash for string_view
Louis Dionne [Wed, 28 Nov 2018 15:22:30 +0000 (15:22 +0000)]
[libcxx] Apply _LIBCPP_INLINE_VISIBILITY for std::hash for string_view

llvm-svn: 347765

5 years agoFix DynamicLibraryTests build on Windows when LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is ON
Michael Platings [Wed, 28 Nov 2018 15:19:55 +0000 (15:19 +0000)]
Fix DynamicLibraryTests build on Windows when LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is ON

extract_symbols.py (introduced in D18826) expects all of its library arguments
to be in the same directory - typically <config>/lib. DynamicLibraryLib.lib is
instead to be found in lib/<config>.
This patch intended to make DynamicLibraryLib.lib be created in <config>/lib
alongside most of the other libraries.

I previously tried passing absolute paths to extract_symbols.py but this
generated command lines that were too long for Visual Studio 2015: D54587

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

llvm-svn: 347764

5 years ago[ThinLTO] Correct linkonce_any function import linkage. NFC.
Xin Tong [Wed, 28 Nov 2018 15:16:35 +0000 (15:16 +0000)]
[ThinLTO] Correct linkonce_any function import linkage. NFC.

Summary:
This is a NFC as we do not import non-odr vague linkage when computing
for import list for a module.

Reviewers: tejohnson, pcc

Subscribers: inglorion, dexonsmith, llvm-commits

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

llvm-svn: 347763

5 years agoFix build error due to missing cctype include
David Spickett [Wed, 28 Nov 2018 15:12:33 +0000 (15:12 +0000)]
Fix build error due to missing cctype include
in ARMTargetParser.cpp.

llvm-svn: 347762

5 years agoFix false positive with lambda assignments in cert-err58-cpp.
Aaron Ballman [Wed, 28 Nov 2018 15:04:38 +0000 (15:04 +0000)]
Fix false positive with lambda assignments in cert-err58-cpp.

This check is about preventing exceptions from being thrown before main() executes, and assigning a lambda (rather than calling it) to a global object cannot throw any exceptions.

llvm-svn: 347761

5 years ago[clang-tidy] Added a test -export-fixes with relative paths.
Ilya Biryukov [Wed, 28 Nov 2018 14:43:26 +0000 (14:43 +0000)]
[clang-tidy] Added a test -export-fixes with relative paths.

Summary: A test for D51864.

Reviewers: ioeric, steveire

Reviewed By: steveire

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 347760

5 years ago[SLP]Fix PR39774: Set ReductionRoot if the original instruction is vectorized.
Alexey Bataev [Wed, 28 Nov 2018 14:34:11 +0000 (14:34 +0000)]
[SLP]Fix PR39774: Set ReductionRoot if the original instruction is vectorized.

Summary:
If the original reduction root instruction was vectorized, it might be
removed from the tree. It means that the insertion point may become
invalidated and the whole vectorization of the reduction leads to the
incorrect output result.
The ReductionRoot instruction must be marked as externally used so it
could not be removed. Otherwise it might cause inconsistency with the
cost model and we may end up with too optimistic optimization.

Reviewers: RKSimon, spatel, hfinkel, mkuper

Subscribers: llvm-commits

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

llvm-svn: 347759

5 years agoRevert r347673 "Catch up with EvaluateAsInt() clang API change."
Hans Wennborg [Wed, 28 Nov 2018 14:30:18 +0000 (14:30 +0000)]
Revert r347673 "Catch up with EvaluateAsInt() clang API change."

r347417 was re-committed in Clang.

llvm-svn: 347758

5 years agoRe-commit r347419 "Update call to EvaluateAsInt() to the new syntax."
Hans Wennborg [Wed, 28 Nov 2018 14:04:26 +0000 (14:04 +0000)]
Re-commit r347419 "Update call to EvaluateAsInt() to the new syntax."

llvm-svn: 347757

5 years agoRe-commit r347417 "Re-Reinstate 347294 with a fix for the failures."
Hans Wennborg [Wed, 28 Nov 2018 14:04:12 +0000 (14:04 +0000)]
Re-commit r347417 "Re-Reinstate 347294 with a fix for the failures."

This was reverted in r347656 due to me thinking it caused a miscompile of
Chromium. Turns out it was the Chromium code that was broken.

llvm-svn: 347756

5 years ago[clangd] Fix test broken in r347754.
Eric Liu [Wed, 28 Nov 2018 14:00:09 +0000 (14:00 +0000)]
[clangd] Fix test broken in r347754.

llvm-svn: 347755

5 years ago[clangd] Less penalty for cross-namespace completions.
Eric Liu [Wed, 28 Nov 2018 13:45:25 +0000 (13:45 +0000)]
[clangd] Less penalty for cross-namespace completions.

llvm-svn: 347754

5 years ago[clangd] Build and test IndexBenchmark in check-clangd
Haojian Wu [Wed, 28 Nov 2018 13:31:05 +0000 (13:31 +0000)]
[clangd] Build and test IndexBenchmark in check-clangd

Summary:
Include IndexBenchmark in check-clangd to make sure we won't forget to update
it when doing breaking changes; also fix an out-of-date test input.

Reviewers: ilya-biryukov

Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 347753

5 years ago[ASTImporter] Changed use of Import to Import_New in ASTImporter.
Balazs Keri [Wed, 28 Nov 2018 13:21:26 +0000 (13:21 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTImporter.

Reviewers: a.sidorin, shafik, a_sidorin

Reviewed By: a_sidorin

Subscribers: gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits

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

llvm-svn: 347752

5 years agoFix a typo.
Haojian Wu [Wed, 28 Nov 2018 13:20:39 +0000 (13:20 +0000)]
Fix a typo.

llvm-svn: 347751

5 years agoFix build error.
Haojian Wu [Wed, 28 Nov 2018 13:15:06 +0000 (13:15 +0000)]
Fix build error.

llvm-svn: 347750

5 years agoFix -Winfinite-recursion compile error.
Haojian Wu [Wed, 28 Nov 2018 12:32:53 +0000 (12:32 +0000)]
Fix -Winfinite-recursion compile error.

llvm-svn: 347749

5 years agoFix build of r347741 by adding missing vector
David Spickett [Wed, 28 Nov 2018 12:05:36 +0000 (12:05 +0000)]
Fix build of r347741 by adding missing vector
include to ARMTargetParser.h.

llvm-svn: 347748

5 years ago[MachineScheduler] Add support for clustering mem ops with FI base operands
Francis Visoiu Mistrih [Wed, 28 Nov 2018 12:00:28 +0000 (12:00 +0000)]
[MachineScheduler] Add support for clustering mem ops with FI base operands

Before this patch, the following stores in `merge_fail` would fail to be
merged, while they would get merged in `merge_ok`:

```
void use(unsigned long long *);
void merge_fail(unsigned key, unsigned index)
{
  unsigned long long args[8];
  args[0] = key;
  args[1] = index;
  use(args);
}
void merge_ok(unsigned long long *dst, unsigned a, unsigned b)
{
  dst[0] = a;
  dst[1] = b;
}
```

The reason is that `getMemOpBaseImmOfs` would return false for FI base
operands.

This adds support for this.

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

llvm-svn: 347747

5 years ago[CodeGen][NFC] Make `TII::getMemOpBaseImmOfs` return a base operand
Francis Visoiu Mistrih [Wed, 28 Nov 2018 12:00:20 +0000 (12:00 +0000)]
[CodeGen][NFC] Make `TII::getMemOpBaseImmOfs` return a base operand

Currently, instructions doing memory accesses through a base operand that is
not a register can not be analyzed using `TII::getMemOpBaseRegImmOfs`.

This means that functions such as `TII::shouldClusterMemOps` will bail
out on instructions using an FI as a base instead of a register.

The goal of this patch is to refactor all this to return a base
operand instead of a base register.

Then in a separate patch, I will add FI support to the mem op clustering
in the MachineScheduler.

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

llvm-svn: 347746