platform/upstream/llvm.git
5 years ago[InstCombine] Fix negative GEP offset evaluation for 32-bit pointers
Nikita Popov [Wed, 12 Dec 2018 23:19:03 +0000 (23:19 +0000)]
[InstCombine] Fix negative GEP offset evaluation for 32-bit pointers

This fixes https://bugs.llvm.org/show_bug.cgi?id=39908.

The evaluateGEPOffsetExpression() function simplifies GEP offsets for
use in comparisons against zero, basically by converting X*Scale+Offset==0
to X+Offset/Scale==0 if Scale divides Offset. However, before this is done,
Offset is masked down to the pointer size. This results in incorrect
results for negative Offsets, because we basically end up dividing the
32-bit offset *zero* extended to 64-bit bits (rather than sign extended).

Fix this by explicitly sign extending the truncated value.

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

llvm-svn: 348987

5 years ago[hwasan] Link ubsan_cxx to shared runtime library.
Evgeniy Stepanov [Wed, 12 Dec 2018 22:56:00 +0000 (22:56 +0000)]
[hwasan] Link ubsan_cxx to shared runtime library.

Summary: This is needed for C++-specific ubsan and cfi error reporting to work.

Reviewers: kcc, vitalybuka

Subscribers: srhines, kubamracek, mgorny, llvm-commits

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

llvm-svn: 348986

5 years ago[llvm-objcopy] Change Segment::Type from uint64_t to uint32_t
Fangrui Song [Wed, 12 Dec 2018 22:46:37 +0000 (22:46 +0000)]
[llvm-objcopy] Change Segment::Type from uint64_t to uint32_t

Summary:
In both Elf{32,64}_Phdr, the field Elf{32,64}_World p_type is uint32_t.

Also reorder the fields to be similar to Elf64_Phdr (which is different
from Elf32_Phdr but quite similar).

Reviewers: rupprecht, jhenderson, jakehehrlich, alexshap, espindola

Reviewed By: rupprecht

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 348985

5 years agoSwitch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)
Ryan Prichard [Wed, 12 Dec 2018 22:45:12 +0000 (22:45 +0000)]
Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)

Summary:
The TLS_SLOT_TSAN slot is available starting in N, but its location (8)
is incompatible with the proposed solution for implementing ELF TLS on
Android (i.e. bump ARM/AArch64 alignment to reserve an 8-word TCB).

Instead, starting in Q, Bionic replaced TLS_SLOT_DLERROR(6) with
TLS_SLOT_SANITIZER(6). Switch compiler-rt to the new slot.

Reviewers: eugenis, srhines, enh

Reviewed By: eugenis

Subscribers: ruiu, srhines, kubamracek, javed.absar, kristof.beyls, delcypher, llvm-commits, #sanitizers

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

llvm-svn: 348984

5 years ago[hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)
Ryan Prichard [Wed, 12 Dec 2018 22:45:06 +0000 (22:45 +0000)]
[hwasan] Android: Switch from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)

Summary:
The change is needed to support ELF TLS in Android. See D55581 for the
same change in compiler-rt.

Reviewers: srhines, eugenis

Reviewed By: eugenis

Subscribers: srhines, llvm-commits

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

llvm-svn: 348983

5 years agoRevert "Declares __cpu_model as dso local"
Haibo Huang [Wed, 12 Dec 2018 22:39:51 +0000 (22:39 +0000)]
Revert "Declares __cpu_model as dso local"

This reverts r348978

llvm-svn: 348982

5 years agoAvoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC.
Martin Storsjo [Wed, 12 Dec 2018 22:24:42 +0000 (22:24 +0000)]
Avoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC.

This requires making Registers_*::getRegisterName static.

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

llvm-svn: 348981

5 years ago[PhaseOrdering] add test for funnel shift (rotate); NFC
Sanjay Patel [Wed, 12 Dec 2018 22:11:05 +0000 (22:11 +0000)]
[PhaseOrdering] add test for funnel shift (rotate); NFC

As mentioned in D55604, there are 2 bugs here:
1. The new pass manager is speculating wildly by default.
2. The old pass manager is not converting this to funnel shift.

llvm-svn: 348980

5 years ago[hwasan] Verify Android TLS slot at startup.
Evgeniy Stepanov [Wed, 12 Dec 2018 22:10:52 +0000 (22:10 +0000)]
[hwasan] Verify Android TLS slot at startup.

Summary:
Add a check that TLS_SLOT_TSAN / TLS_SLOT_SANITIZER, whichever
android_get_tls_slot is using, is not conflicting with
TLS_SLOT_DLERROR.

Reviewers: rprichard, vitalybuka

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 348979

5 years agoDeclares __cpu_model as dso local
Haibo Huang [Wed, 12 Dec 2018 22:04:12 +0000 (22:04 +0000)]
Declares __cpu_model as dso local

__builtin_cpu_supports and __builtin_cpu_is use information in __cpu_model to decide cpu features. Before this change, __cpu_model was not declared as dso local. The generated code looks up the address in GOT when reading __cpu_model. This makes it impossible to use these functions in ifunc, because at that time GOT entries have not been relocated. This change makes it dso local.

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

llvm-svn: 348978

5 years ago[AST] Store "UsesADL" information in CallExpr.
Eric Fiselier [Wed, 12 Dec 2018 21:50:55 +0000 (21:50 +0000)]
[AST] Store "UsesADL" information in CallExpr.

Summary:
Currently the Clang AST doesn't store information about how the callee of a CallExpr was found. Specifically if it was found using ADL.

However, this information is invaluable to tooling. Consider a tool which renames usages of a function. If the originally CallExpr was formed using ADL, then the tooling may need to additionally qualify the replacement.
Without information about how the callee was found, the tooling is left scratching it's head. Additionally, we want to be able to match ADL calls as quickly as possible, which means avoiding computing the answer on the fly.

This patch changes `CallExpr` to store whether it's callee was found using ADL. It does not change the size of any AST nodes.

Reviewers: fowles, rsmith, klimek, shafik

Reviewed By: rsmith

Subscribers: aaron.ballman, riccibruno, calabrese, titus, cfe-commits

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

llvm-svn: 348977

5 years ago[globalisel] Rename GISelChangeObserver's erasedInstr() to erasingInstr() and related...
Daniel Sanders [Wed, 12 Dec 2018 21:32:01 +0000 (21:32 +0000)]
[globalisel] Rename GISelChangeObserver's erasedInstr() to erasingInstr() and related nits. NFC

Summary:
There's little of interest that can be done to an already-erased instruction.
You can't inspect it, write it to a debug log, etc. It ought to be notification
that we're about to erase it. Rename the function to clarify the timing of the
event and reflect current usage.

Also fixed one case where we were trying to print an erased instruction.

Reviewers: aditya_nandakumar

Reviewed By: aditya_nandakumar

Subscribers: rovka, kristof.beyls, llvm-commits

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

llvm-svn: 348976

5 years ago[X86] Don't emit MULX by default with BMI2
Craig Topper [Wed, 12 Dec 2018 21:21:31 +0000 (21:21 +0000)]
[X86] Don't emit MULX by default with BMI2

MULX has somewhat improved register allocation constraints compared to the legacy MUL instruction. Both output registers are encoded instead of fixed to EAX/EDX, but EDX is used as input. It also doesn't touch flags. Unfortunately, the encoding is longer.

Prefering it whenever BMI2 is enabled is probably not optimal. Choosing it should somehow be a function of register allocation constraints like converting adds to three address. gcc and icc definitely don't pick MULX by default. Not sure what if any rules they have for using it.

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

llvm-svn: 348975

5 years agoFix for llvm-dwarfdump changes for subroutine types
David Blaikie [Wed, 12 Dec 2018 21:15:48 +0000 (21:15 +0000)]
Fix for llvm-dwarfdump changes for subroutine types

llvm-svn: 348974

5 years ago[test] [depr.c.headers] XFAIL uchar.h on NetBSD
Michal Gorny [Wed, 12 Dec 2018 20:51:46 +0000 (20:51 +0000)]
[test] [depr.c.headers] XFAIL uchar.h on NetBSD

llvm-svn: 348973

5 years ago[X86] Move stack folding test for MULX to a MIR test. Add a MULX32 case as well
Craig Topper [Wed, 12 Dec 2018 20:50:24 +0000 (20:50 +0000)]
[X86] Move stack folding test for MULX to a MIR test. Add a MULX32 case as well

A future patch may stop using MULX by default so use MIR to ensure we're always testing MULX.

Add the 32-bit case that we couldn't do in the 64-bit mode IR test due to it being promoted to a 64-bit mul.

llvm-svn: 348972

5 years ago[AMDGPU] Support for "uniform-work-group-size" attribute
Aakanksha Patil [Wed, 12 Dec 2018 20:49:17 +0000 (20:49 +0000)]
[AMDGPU] Support for "uniform-work-group-size" attribute

Updated the annotate-kernel-features pass to support the propagation of uniform-work-group attribute from the kernel to the called functions. Once this pass is run, all kernels, even the ones which initially did not have the attribute, will be able to indicate weather or not they have uniform work group size depending on the value of the attribute.

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

llvm-svn: 348971

5 years agoSupport: use internal `call_once` on PPC64le
Saleem Abdulrasool [Wed, 12 Dec 2018 20:35:47 +0000 (20:35 +0000)]
Support: use internal `call_once` on PPC64le

Use the replacement execute once threading support in LLVM for PPC64le.  It
seems that GCC does not define `__ppc__` and so we would actually call out to
the C++ runtime there which is not what the current code intended.  Check both
`__ppc__` and `__PPC__`.  This avoids the need for checking the endianness.

Thanks to nemanjai for the hint about GCC's behaviour and the fact that the
reviewed condition could be simplified.

Original patch by Sarvesh Tamba!

llvm-svn: 348970

5 years agoTeach __builtin_unpredictable to work through implicit casts.
Erich Keane [Wed, 12 Dec 2018 20:30:53 +0000 (20:30 +0000)]
Teach __builtin_unpredictable to work through implicit casts.

The __builtin_unpredictable implementation is confused by any implicit
casts, which happen in C++.  This patch strips those off so that
if/switch statements now work with it in C++.

Change-Id: I73c3bf4f1775cd906703880944f4fcdc29fffb0a
llvm-svn: 348969

5 years ago[test] [filesystems] NetBSD can do symlink permissions too
Michal Gorny [Wed, 12 Dec 2018 20:28:52 +0000 (20:28 +0000)]
[test] [filesystems] NetBSD can do symlink permissions too

llvm-svn: 348968

5 years ago[test] [filesystems] Extend FreeBSD tv_sec==-1 workaround to NetBSD
Michal Gorny [Wed, 12 Dec 2018 20:20:15 +0000 (20:20 +0000)]
[test] [filesystems] Extend FreeBSD tv_sec==-1 workaround to NetBSD

NetBSD also uses tv_sec==-1 as error status indicator, and does not
support setting such a value.

llvm-svn: 348967

5 years ago[X86] Added missing constant pool checks. NFCI.
Simon Pilgrim [Wed, 12 Dec 2018 19:56:38 +0000 (19:56 +0000)]
[X86] Added missing constant pool checks. NFCI.

So the extra checks in D55600 don't look like a regression.

llvm-svn: 348966

5 years agoDebugInfo/DWARF: Pretty print subroutine types
David Blaikie [Wed, 12 Dec 2018 19:53:03 +0000 (19:53 +0000)]
DebugInfo/DWARF: Pretty print subroutine types

Doesn't handle varargs and other fun things, but it's a start. (also
doesn't print these strictly as valid C++ when it's a pointer to
function, it'll print as "void(int)*" instead of "void (*)(int)")

llvm-svn: 348965

5 years ago[AMDGPU] Emit MessagePack HSA Metadata for v3 code object
Scott Linder [Wed, 12 Dec 2018 19:39:27 +0000 (19:39 +0000)]
[AMDGPU] Emit MessagePack HSA Metadata for v3 code object

Continue to present HSA metadata as YAML in ASM and when output by tools
(e.g. llvm-readobj), but encode it in Messagepack in the code object.

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

llvm-svn: 348963

5 years agoDebugInfo/DWARF: Improve dumping of pointers to members ('int foo::*' rather than...
David Blaikie [Wed, 12 Dec 2018 19:34:02 +0000 (19:34 +0000)]
DebugInfo/DWARF: Improve dumping of pointers to members ('int foo::*' rather than 'int*')

llvm-svn: 348962

5 years agoDebugInfo/DWARF: Refactor type dumping to dump types, rather than DIEs that reference...
David Blaikie [Wed, 12 Dec 2018 19:33:08 +0000 (19:33 +0000)]
DebugInfo/DWARF: Refactor type dumping to dump types, rather than DIEs that reference types

This lays the foundation for dumping types not referenced by DW_AT_type
attributes (in the near-term, that'll be DW_AT_containing_type for a
DW_TAG_ptr_to_member_type - in the future, potentially dumping the
pretty printed name next to the DW_TAG for the type, rather than only
when the type is referenced from elsewhere)

llvm-svn: 348961

5 years agoDebugInfo/DWARF: Refactor getAttributeValueAsReferencedDie to accept a DWARFFormValue
David Blaikie [Wed, 12 Dec 2018 19:23:55 +0000 (19:23 +0000)]
DebugInfo/DWARF: Refactor getAttributeValueAsReferencedDie to accept a DWARFFormValue

Save searching for the attribute again when you already have the
DWARFFormValue at hand.

llvm-svn: 348960

5 years ago[X86] Emit SBB instead of SETCC_CARRY from LowerSELECT. Break false dependency on...
Craig Topper [Wed, 12 Dec 2018 19:20:21 +0000 (19:20 +0000)]
[X86] Emit SBB instead of SETCC_CARRY from LowerSELECT. Break false dependency on the SBB input.

I'm hoping we can just replace SETCC_CARRY with SBB. This is another step towards that.

I've explicitly used zero as the input to the setcc to avoid a false dependency that we've had with the SETCC_CARRY. I changed one of the patterns that used NEG to instead use an explicit compare with 0 on the LHS. We needed the zero anyway to avoid the false dependency. The negate would clobber its input register. By using a CMP we can avoid that which could be useful.

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

llvm-svn: 348959

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Wed, 12 Dec 2018 19:01:39 +0000 (19:01 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 348958

5 years ago[ConstantFold] Use getMinSignedBits for APInt in isIndexInRangeOfArrayType.
Florian Hahn [Wed, 12 Dec 2018 18:55:14 +0000 (18:55 +0000)]
[ConstantFold] Use getMinSignedBits for APInt in isIndexInRangeOfArrayType.

Indices for getelementptr can be signed so we should use
getMinSignedBits instead of getActiveBits here. The function later calls
getSExtValue to get the int64_t value, which also checks
getMinSignedBits.

This fixes  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11647.

Reviewers: mssimpso, efriedma, davide

Reviewed By: efriedma

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

llvm-svn: 348957

5 years ago[X86] Added missing constant pool checks. NFCI.
Simon Pilgrim [Wed, 12 Dec 2018 18:53:12 +0000 (18:53 +0000)]
[X86] Added missing constant pool checks. NFCI.

So the extra checks in D55600 don't look like a regression.

llvm-svn: 348956

5 years agoUpdate for an llvm-dwarfdump change in output
David Blaikie [Wed, 12 Dec 2018 18:46:43 +0000 (18:46 +0000)]
Update for an llvm-dwarfdump change in output

llvm-svn: 348955

5 years agollvm-dwarfdump: Dump array dimensions in stringified type names
David Blaikie [Wed, 12 Dec 2018 18:46:25 +0000 (18:46 +0000)]
llvm-dwarfdump: Dump array dimensions in stringified type names

llvm-svn: 348954

5 years ago[SelectionDAG] Add a generic isSplatValue function
Simon Pilgrim [Wed, 12 Dec 2018 18:32:29 +0000 (18:32 +0000)]
[SelectionDAG] Add a generic isSplatValue function

This patch introduces a generic function to determine whether a given vector type is known to be a splat value for the specified demanded elements, recursing up the DAG looking for BUILD_VECTOR or VECTOR_SHUFFLE splat patterns.

It also keeps track of the elements that are known to be UNDEF - it returns true if all the demanded elements are UNDEF (as this may be useful under some circumstances), so this needs to be handled by the caller.

A wrapper variant is also provided that doesn't take the DemandedElts or UndefElts arguments for cases where we just want to know if the SDValue is a splat or not (with/without UNDEFS).

I had hoped to completely remove the X86 local version of this function, but I'm seeing some regressions in shift/rotate codegen that will take a little longer to fix and I hope to get this in sooner so I can continue work on PR38243 which needs more capable splat detection.

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

llvm-svn: 348953

5 years ago[NVPTX] do not rely on cached subtarget info.
Artem Belevich [Wed, 12 Dec 2018 18:31:04 +0000 (18:31 +0000)]
[NVPTX] do not rely on cached subtarget info.
If a module has function references, but no functions
themselves, we may end up never calling runOnMachineFunction
and therefore would never initialize nvptxSubtarget field
which would eventually cause a crash.

Instead of relying on nvptxSubtarget being initialized by
one of the methods, retrieve subtarget info directly.

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

llvm-svn: 348952

5 years agoNFC: fix compiler warning about code never being executed when compiling on non windo...
Greg Clayton [Wed, 12 Dec 2018 18:14:27 +0000 (18:14 +0000)]
NFC: fix compiler warning about code never being executed when compiling on non windows platform.

llvm-svn: 348951

5 years agoChange CallGraph print to show the fully qualified name
Erich Keane [Wed, 12 Dec 2018 18:11:36 +0000 (18:11 +0000)]
Change CallGraph print to show the fully qualified name

CallGraph previously would just show the normal name of a function,
which gets really confusing when using it on large C++ projects.  This
patch switches the printName call to a printQualifiedName, so that the
namespaces are included.

Change-Id: Ie086d863f6b2251be92109ea1b0946825b28b49a
llvm-svn: 348950

5 years ago[LV] Fix signed/unsigned comparison warning.
Michael Kruse [Wed, 12 Dec 2018 18:07:19 +0000 (18:07 +0000)]
[LV] Fix signed/unsigned comparison warning.

llvm-svn: 348949

5 years ago[gn build] Merge r348944
Nico Weber [Wed, 12 Dec 2018 18:04:57 +0000 (18:04 +0000)]
[gn build] Merge r348944

llvm-svn: 348948

5 years ago[docs] Use correct ending quotes.
Michael Kruse [Wed, 12 Dec 2018 17:59:01 +0000 (17:59 +0000)]
[docs] Use correct ending quotes.

llvm-svn: 348947

5 years ago[x86] allow 8-bit adds to be promoted by convertToThreeAddress() to form LEA
Sanjay Patel [Wed, 12 Dec 2018 17:58:27 +0000 (17:58 +0000)]
[x86] allow 8-bit adds to be promoted by convertToThreeAddress() to form LEA

This extends the code that handles 16-bit add promotion to form LEA to also allow 8-bit adds.
That allows us to combine add ops with register moves and save some instructions. This is
another step towards allowing add truncation in generic DAGCombiner (see D54640).

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

llvm-svn: 348946

5 years ago[gn build] Add all non-test build files for lld
Nico Weber [Wed, 12 Dec 2018 17:57:10 +0000 (17:57 +0000)]
[gn build] Add all non-test build files for lld

Version.inc.in processing has a potentially interesting part which I've punted
on for now (LLD_REVISION and LLD_REPOSITORY are set to empty strings for now).

lld now builds in the gn build. But no symlinks to it are created yet, so it
can't be meaningfully run yet.

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

llvm-svn: 348945

5 years ago[Unroll/UnrollAndJam/Vectorizer/Distribute] Add followup loop attributes.
Michael Kruse [Wed, 12 Dec 2018 17:32:52 +0000 (17:32 +0000)]
[Unroll/UnrollAndJam/Vectorizer/Distribute] Add followup loop attributes.

When multiple loop transformation are defined in a loop's metadata, their order of execution is defined by the order of their respective passes in the pass pipeline. For instance, e.g.

    #pragma clang loop unroll_and_jam(enable)
    #pragma clang loop distribute(enable)

is the same as

    #pragma clang loop distribute(enable)
    #pragma clang loop unroll_and_jam(enable)

and will try to loop-distribute before Unroll-And-Jam because the LoopDistribute pass is scheduled after UnrollAndJam pass. UnrollAndJamPass only supports one inner loop, i.e. it will necessarily fail after loop distribution. It is not possible to specify another execution order. Also,t the order of passes in the pipeline is subject to change between versions of LLVM, optimization options and which pass manager is used.

This patch adds 'followup' attributes to various loop transformation passes. These attributes define which attributes the resulting loop of a transformation should have. For instance,

    !0 = !{!0, !1, !2}
    !1 = !{!"llvm.loop.unroll_and_jam.enable"}
    !2 = !{!"llvm.loop.unroll_and_jam.followup_inner", !3}
    !3 = !{!"llvm.loop.distribute.enable"}

defines a loop ID (!0) to be unrolled-and-jammed (!1) and then the attribute !3 to be added to the jammed inner loop, which contains the instruction to distribute the inner loop.

Currently, in both pass managers, pass execution is in a fixed order and UnrollAndJamPass will not execute again after LoopDistribute. We hope to fix this in the future by allowing pass managers to run passes until a fixpoint is reached, use Polly to perform these transformations, or add a loop transformation pass which takes the order issue into account.

For mandatory/forced transformations (e.g. by having been declared by #pragma omp simd), the user must be notified when a transformation could not be performed. It is not possible that the responsible pass emits such a warning because the transformation might be 'hidden' in a followup attribute when it is executed, or it is not present in the pipeline at all. For this reason, this patche introduces a WarnMissedTransformations pass, to warn about orphaned transformations.

Since this changes the user-visible diagnostic message when a transformation is applied, two test cases in the clang repository need to be updated.

To ensure that no other transformation is executed before the intended one, the attribute `llvm.loop.disable_nonforced` can be added which should disable transformation heuristics before the intended transformation is applied. E.g. it would be surprising if a loop is distributed before a #pragma unroll_and_jam is applied.

With more supported code transformations (loop fusion, interchange, stripmining, offloading, etc.), transformations can be used as building blocks for more complex transformations (e.g. stripmining+stripmining+interchange -> tiling).

Reviewed By: hfinkel, dmgreen

Differential Revision: https://reviews.llvm.org/D49281
Differential Revision: https://reviews.llvm.org/D55288

llvm-svn: 348944

5 years ago[Driver] Add support for -fembed-bitcode for assembly file
Steven Wu [Wed, 12 Dec 2018 17:30:16 +0000 (17:30 +0000)]
[Driver] Add support for -fembed-bitcode for assembly file

Summary:
Handle -fembed-bitcode for assembly inputs. When the input file is
assembly, write a marker as "__LLVM,__asm" section.

Fix llvm.org/pr39659

Reviewers: compnerd, dexonsmith

Reviewed By: compnerd

Subscribers: rjmccall, dblaikie, jkorous, cfe-commits

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

llvm-svn: 348943

5 years agoMake clang::CallGraph look into template instantiations
Erich Keane [Wed, 12 Dec 2018 17:22:52 +0000 (17:22 +0000)]
Make clang::CallGraph look into template instantiations

Clang's CallGraph analysis doesn't use the RecursiveASTVisitor's setting
togo into template instantiations.  The result is that anything wanting
to do call graph analysis ends up missing any template function calls.

Change-Id: Ib4af44ed59f15d43f37af91622a203146a3c3189
llvm-svn: 348942

5 years ago[ast] CreateParameterDeclaration should use an appropriate DeclContext.
Zachary Turner [Wed, 12 Dec 2018 17:17:53 +0000 (17:17 +0000)]
[ast] CreateParameterDeclaration should use an appropriate DeclContext.

Previously CreateParameterDeclaration was always using the translation
unit DeclContext.  We would later go and add parameters to the
FunctionDecl, but internally clang makes a copy when you do this, and
we'd end up with ParmVarDecl's at the global scope as well as in the
function scope.

This fixes the issue.  It's hard to say whether this will introduce
a behavioral change in name lookup, but I know there have been several
hacks introduced in previous years to deal with collisions between
various types of variables, so there's a chance that this patch could
obviate one of those hacks.

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

llvm-svn: 348941

5 years ago[SampleFDO] Extend profile-sample-accurate option to cover isFunctionColdInCallGraph
Wei Mi [Wed, 12 Dec 2018 17:09:27 +0000 (17:09 +0000)]
[SampleFDO] Extend profile-sample-accurate option to cover isFunctionColdInCallGraph

For SampleFDO, when a callsite doesn't appear in the profile, it will not be marked as cold callsite unless the option -profile-sample-accurate is specified.

But profile-sample-accurate doesn't cover function isFunctionColdInCallGraph which is used to decide whether a function should be put into text.unlikely section, so even if the user knows the profile is accurate and specifies profile-sample-accurate, those functions not appearing in the sample profile are still not be put into text.unlikely section right now.

The patch fixes that.

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

llvm-svn: 348940

5 years agoBasic: make `int_least64_t` and `int_fast64_t` match on Darwin
Saleem Abdulrasool [Wed, 12 Dec 2018 17:05:20 +0000 (17:05 +0000)]
Basic: make `int_least64_t` and `int_fast64_t` match on Darwin

The Darwin targets use `int64_t` and `uint64_t` to define the `int_least64_t`
and `int_fast64_t` types.  The underlying type is actually a `long long`.  Match
the types to allow the printf specifiers to work properly and have the compiler
vended macros match the implementation on the target.

llvm-svn: 348939

5 years ago[ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element types
Hubert Tong [Wed, 12 Dec 2018 16:53:43 +0000 (16:53 +0000)]
[ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element types

Summary:
`memchr` and `memcmp` operate upon the character units of the object
representation; that is, the `size_t` parameter expresses the number of
character units. The constant folding implementation is updated in this
patch to account for multibyte element types in the arrays passed to
`memchr`/`memcmp` and, in the case of `memcmp`, to account for the
possibility that the arrays may have differing element types (even when
they are byte-sized).

Actual inspection of the object representation is not implemented.
Comparisons are done only between elements with the same object size;
that is, `memchr` will fail when inspecting at least one character unit
of a multibyte element. The integer types are assumed to have two's
complement representation with 0 for `false`, 1 for `true`, and no
padding bits.

`memcmp` on multibyte elements will only be able to fold in cases where
enough elements are equal for the answer to be 0.

Various tests are added to guard against incorrect folding for cases
that miscompile on some system or other prior to this patch. At the same
time, the unsigned 32-bit `wchar_t` testing in
`test/SemaCXX/constexpr-string.cpp` is restored.

Reviewers: rsmith, aaron.ballman, hfinkel

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 348938

5 years ago[AMDGPU] Extend the SI Load/Store optimizer to combine more things.
Neil Henning [Wed, 12 Dec 2018 16:15:21 +0000 (16:15 +0000)]
[AMDGPU] Extend the SI Load/Store optimizer to combine more things.

I've extended the load/store optimizer to be able to produce dwordx3
loads and stores, This change allows many more load/stores to be combined,
and results in much more optimal code for our hardware.

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

llvm-svn: 348937

5 years agoELF: Clean up section type computation
Pavel Labath [Wed, 12 Dec 2018 15:46:18 +0000 (15:46 +0000)]
ELF: Clean up section type computation

Move code into a separate function, and replace the if-else chain with
llvm::StringSwitch.

A slight behavioral change is that now I use the section flags
(SHF_TLS) instead of the section name to set the thread-specific
property. There is no explanation in the original commit introducing
this (r153537) as to why that was done this way, but the new behavior
should be more correct.

llvm-svn: 348936

5 years ago[mips] Enable using of integrated assembler in all cases.
Simon Atanasyan [Wed, 12 Dec 2018 15:32:25 +0000 (15:32 +0000)]
[mips] Enable using of integrated assembler in all cases.

llvm-svn: 348935

5 years ago[mips] Enable using of integrated assembler in all cases.
Simon Atanasyan [Wed, 12 Dec 2018 15:32:03 +0000 (15:32 +0000)]
[mips] Enable using of integrated assembler in all cases.

llvm-svn: 348934

5 years ago[AggressiveInstCombine] add tests for rotates with branch; NFC
Sanjay Patel [Wed, 12 Dec 2018 15:28:21 +0000 (15:28 +0000)]
[AggressiveInstCombine] add tests for rotates with branch; NFC

llvm-svn: 348933

5 years agoRemove TODO leftover from my devleopment branch
Erich Keane [Wed, 12 Dec 2018 15:13:00 +0000 (15:13 +0000)]
Remove TODO leftover from my devleopment branch

Accidentially checked in a TODO line from r348899. This removes it.

Change-Id: I74b59c0ecfe147af8a08dd7fd10893a4ca351d6d
llvm-svn: 348932

5 years agoRevert "[OpenCL] Add generic AS to 'this' pointer"
Mikael Nilsson [Wed, 12 Dec 2018 15:06:16 +0000 (15:06 +0000)]
Revert "[OpenCL] Add generic AS to 'this' pointer"

Reverting because the patch broke lldb.

llvm-svn: 348931

5 years ago[CUDA][OPENMP][NVPTX]Improve logic of the debug info support.
Alexey Bataev [Wed, 12 Dec 2018 14:52:27 +0000 (14:52 +0000)]
[CUDA][OPENMP][NVPTX]Improve logic of the debug info support.

Summary:
Added support for the -gline-directives-only option + fixed logic of the
debug info for CUDA devices. If optimization level is O0, then options
--[no-]cuda-noopt-device-debug do not affect the debug info level. If
the optimization level is >O0, debug info options are used +
--no-cuda-noopt-device-debug is used or no --cuda-noopt-device-debug is
used, the optimization level for the device code is kept and the
emission of the debug directives is used.
If the opt level is > O0, debug info is requested +
--cuda-noopt-device-debug option is used, the optimization is disabled
for the device code + required debug info is emitted.

Reviewers: tra, echristo

Subscribers: aprantl, guansong, JDevlieghere, cfe-commits

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

llvm-svn: 348930

5 years ago[clang-fuzzer] Add explicit dependency on clangSerialization for clangHandleCXX after...
Alex Bradbury [Wed, 12 Dec 2018 14:33:24 +0000 (14:33 +0000)]
[clang-fuzzer] Add explicit dependency on clangSerialization for clangHandleCXX after rC348907

This library was breaking my -DBUILD_SHARED_LIBS=1 build. rC348915 seemed to miss this case.

As this seems an "obvious" fix, I am committing without pre-commit review as
per the LLVM developer policy.

llvm-svn: 348929

5 years agoELF: Simplify program header iteration
Pavel Labath [Wed, 12 Dec 2018 14:20:28 +0000 (14:20 +0000)]
ELF: Simplify program header iteration

Instead of GetProgramHeaderCount+GetProgramHeaderByIndex, expose an
ArrayRef of all program headers, to enable range-based iteration.
Instead of GetSegmentDataByIndex, expose GetSegmentData, taking a
program header (reference).

This makes the code simpler by enabling range-based loops and also
allowed to remove some null checks, as it became locally obvious that
some pointers can never be null.

llvm-svn: 348928

5 years ago[OpenCL] Add generic AS to 'this' pointer
Mikael Nilsson [Wed, 12 Dec 2018 14:11:59 +0000 (14:11 +0000)]
[OpenCL] Add generic AS to 'this' pointer

Address spaces are cast into generic before invoking the constructor.

Added support for a trailing Qualifiers object in FunctionProtoType.

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

llvm-svn: 348927

5 years ago[TargetLowering] Add ISD::AND handling to SimplifyDemandedVectorElts
Simon Pilgrim [Wed, 12 Dec 2018 13:43:07 +0000 (13:43 +0000)]
[TargetLowering] Add ISD::AND handling to SimplifyDemandedVectorElts

If either of the operand elements are zero then we know the result element is going to be zero (even if the other element is undef).

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

llvm-svn: 348926

5 years agoRegenerate knownbits test. NFCI.
Simon Pilgrim [Wed, 12 Dec 2018 13:21:03 +0000 (13:21 +0000)]
Regenerate knownbits test. NFCI.

A future SimplifyDemandedBits patch will affect this code and I want to ensure the codegen diff is obvious.

llvm-svn: 348925

5 years agolldb-test: Add ability to dump subsections
Pavel Labath [Wed, 12 Dec 2018 12:35:25 +0000 (12:35 +0000)]
lldb-test: Add ability to dump subsections

Previously, lldb-test would only print top-level sections. However, in
lldb, sections can contain other sections. This teaches lldb-test to
print nested sections too.

llvm-svn: 348924

5 years ago[ASTImporter] Remove import of definition from GetAlreadyImportedOrNull
Gabor Marton [Wed, 12 Dec 2018 11:22:55 +0000 (11:22 +0000)]
[ASTImporter] Remove import of definition from GetAlreadyImportedOrNull

Summary: a_sidorin

Reviewers: a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

llvm-svn: 348923

5 years ago[AMDGPU] Set metadata access for explicit section
Piotr Sobczak [Wed, 12 Dec 2018 11:20:04 +0000 (11:20 +0000)]
[AMDGPU] Set metadata access for explicit section

Summary:
This patch provides a means to set Metadata section kind
for a global variable, if its explicit section name is
prefixed with ".AMDGPU.metadata."
This could be useful to make the global variable go to
an ELF section without any section flags set.

Reviewers: dstuttard, tpr, kzhuravl, nhaehnle, t-tye

Reviewed By: dstuttard, kzhuravl

Subscribers: llvm-commits, arsenm, jvesely, wdng, yaxunl, t-tye

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

llvm-svn: 348922

5 years ago[lit]Add llvm-readelf to tool substitutions
James Henderson [Wed, 12 Dec 2018 10:34:01 +0000 (10:34 +0000)]
[lit]Add llvm-readelf to tool substitutions

Reviewed by: rnk, alexsahp

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

llvm-svn: 348921

5 years ago[ARM GlobalISel] Select load/store for Thumb2
Diana Picus [Wed, 12 Dec 2018 10:32:15 +0000 (10:32 +0000)]
[ARM GlobalISel] Select load/store for Thumb2

Unfortunately we can't use TableGen for this because it doesn't yet
support predicates on the source pattern root. Therefore, add a bit of
handwritten code to the instruction selector to handle the most basic
cases.

Also mark them as legal and extract their legalizer test cases to a new
test file.

llvm-svn: 348920

5 years ago[OpenCL] Fix for TBAA information of pointer after addresspacecast
Andrew Savonichev [Wed, 12 Dec 2018 09:51:23 +0000 (09:51 +0000)]
[OpenCL] Fix for TBAA information of pointer after addresspacecast

Summary: When addresspacecast is generated resulting pointer should preserve TBAA information from original value.

Reviewers: rjmccall, yaxunl, Anastasia

Reviewed By: rjmccall

Subscribers: asavonic, kosarev, cfe-commits, llvm-commits

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

llvm-svn: 348919

5 years agobuild.py: Implement "gcc" builder
Pavel Labath [Wed, 12 Dec 2018 08:54:14 +0000 (08:54 +0000)]
build.py: Implement "gcc" builder

Summary:
This implements the gcc builder in build.py script to allow it to
compile host executables when running on a non-windows host. Where it
made sense, I tried to share code with the msvc builder by moving stuff
to the base class.

Reviewers: zturner

Subscribers: mehdi_amini, dexonsmith, lldb-commits

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

llvm-svn: 348918

5 years ago[SystemZ] Minor cleanup of SchedModels
Jonas Paulsson [Wed, 12 Dec 2018 08:26:24 +0000 (08:26 +0000)]
[SystemZ]  Minor cleanup of SchedModels

Some fixes of a few InstRWs for z13 and z14.

Review: Ulrich Weigand
llvm-svn: 348917

5 years agoAdd explicit dependency on clangSerialization after rC348911
Fangrui Song [Wed, 12 Dec 2018 08:25:16 +0000 (08:25 +0000)]
Add explicit dependency on clangSerialization after rC348911

llvm-svn: 348916

5 years agoAdd explicit dependency on clangSerialization for a bunch of components to fix -DBUIL...
Fangrui Song [Wed, 12 Dec 2018 08:02:18 +0000 (08:02 +0000)]
Add explicit dependency on clangSerialization for a bunch of components to fix -DBUILD_SHARED_LIBS=on build

This is a more thorough fix of rC348911.
The story about -DBUILD_SHARED_LIBS=on build after rC348907 (Move PCHContainerOperations from Frontend to Serialization) is:

1. libclangSerialization.so defines PCHContainerReader dtor, ...
2. clangFrontend and clangTooling define classes inheriting from PCHContainerReader, thus their DSOs have undefined references on PCHContainerReader dtor
3. Components depending on either clangFrontend or clangTooling cannot be linked unless they have explicit dependency on clangSerialization due to the default linker option -z defs. The explicit dependency could be avoided if libclang{Frontend,Tooling}.so had these undefined references.

This patch adds the explicit dependency on clangSerialization to make them build.

llvm-svn: 348915

5 years ago[mips] Use llvm-mc -triple option instead of combination of arch,target-abi,mcpu...
Simon Atanasyan [Wed, 12 Dec 2018 07:03:04 +0000 (07:03 +0000)]
[mips] Use llvm-mc -triple option instead of combination of arch,target-abi,mcpu. NFC

llvm-svn: 348914

5 years agoFix compiler warning about unused variable [NFC]
Mikael Holmen [Wed, 12 Dec 2018 06:33:45 +0000 (06:33 +0000)]
Fix compiler warning about unused variable [NFC]

llvm-svn: 348913

5 years ago[Intrinsic] Signed Fixed Point Multiplication Intrinsic
Leonard Chan [Wed, 12 Dec 2018 06:29:14 +0000 (06:29 +0000)]
[Intrinsic] Signed Fixed Point Multiplication Intrinsic

Add an intrinsic that takes 2 signed integers with the scale of them provided
as the third argument and performs fixed point multiplication on them.

This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.

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

llvm-svn: 348912

5 years ago[CodeGen] Fix -DBUILD_SHARED_LIBS=on build after rC348907
Fangrui Song [Wed, 12 Dec 2018 06:07:33 +0000 (06:07 +0000)]
[CodeGen] Fix -DBUILD_SHARED_LIBS=on build after rC348907

llvm-svn: 348911

5 years ago[X86] Combine vpmovdw+vpacksswb into vpmovdb.
Craig Topper [Wed, 12 Dec 2018 05:56:01 +0000 (05:56 +0000)]
[X86] Combine vpmovdw+vpacksswb into vpmovdb.

This is similar to the combine we already have for vpmovdw+vpackuswb.

llvm-svn: 348910

5 years ago[X86] Add a few more fptosi test cases to demonstrate -x86-experimental-vector-wideni...
Craig Topper [Wed, 12 Dec 2018 05:55:59 +0000 (05:55 +0000)]
[X86] Add a few more fptosi test cases to demonstrate -x86-experimental-vector-widening legalization not combining vpacksswb+vpmovdw.

We are able to combine vpackuswb+vpmovdw, but we didn't have packsswb+vpmovdw at the time that combine was added.

llvm-svn: 348909

5 years ago[gn build] Add build files for DebugInfo/{DWARF,PDB}, Option, ToolDrivers/llvm-lib...
Nico Weber [Wed, 12 Dec 2018 03:05:59 +0000 (03:05 +0000)]
[gn build] Add build files for DebugInfo/{DWARF,PDB}, Option, ToolDrivers/llvm-lib, and WindowsManifest

The diff in targets.gni is due to me running `gn format` on all .gn and .gni
files.

llvm_enable_dia_sdk is in a gni file because I'm going to have to read it when
writing the lit invocations for check-llvm and check-lld. I've never had the
DIA sdk installed locally so I never tested building with it enabled -- it
probably doesn't Just Work and needs some path to diaguids.lib. We can finish
that once somebody needs it.

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

llvm-svn: 348908

5 years agoMove PCHContainerOperations from Frontend to Serialization
Richard Trieu [Wed, 12 Dec 2018 02:53:59 +0000 (02:53 +0000)]
Move PCHContainerOperations from Frontend to Serialization

Fix a layering violation.  Frontend depends on Serialization, so anything used
by both should be in Serialization.

llvm-svn: 348907

5 years ago[ConstantInt] Check active bits before calling getZExtValue.
Florian Hahn [Wed, 12 Dec 2018 02:22:12 +0000 (02:22 +0000)]
[ConstantInt] Check active bits before calling getZExtValue.

Without this check, we hit an assertion in getZExtValue, if the constant
value does not fit into an uint64_t.

As getZExtValue returns an uint64_t, should we update
getAggregateElement to take an uin64_t as well?

This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6109.

Reviewers: efriedma, craig.topper, spatel

Reviewed By: efriedma

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

llvm-svn: 348906

5 years ago[gn build] Add build files for lib/LTO, lib/Linker, lib/Passes, lib/Transforms/{IPO...
Nico Weber [Wed, 12 Dec 2018 00:04:38 +0000 (00:04 +0000)]
[gn build] Add build files for lib/LTO, lib/Linker, lib/Passes, lib/Transforms/{IPO,Instrumentation,ObjCARC}

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

llvm-svn: 348905

5 years agoImplement IMAGE_REL_AMD64_SECREL for RuntimeDyldCOFFX86_64
Nathan Lanza [Wed, 12 Dec 2018 00:04:06 +0000 (00:04 +0000)]
Implement IMAGE_REL_AMD64_SECREL for RuntimeDyldCOFFX86_64

lldb on Windows uses the ExecutionEngine for expression evaluation
and hits the llvm_unreachable due to this relocation. Thus, implement
the relocation and add a test to verify it's function.

llvm-svn: 348904

5 years ago[gn build] Add build files for Target/X86/... and for tools/llc
Nico Weber [Wed, 12 Dec 2018 00:03:23 +0000 (00:03 +0000)]
[gn build] Add build files for Target/X86/... and for tools/llc

The tablegen setup for Target/X86 is a bit different from the CMake build: In
the CMake build, Target/X86/CMakeLists.txt has a single tablegen target that
does everything. But some of the generated files are only used privately by a
subproject, so in the GN build some of the tablegen invocations are
smaller-scoped, mostly for build cleanliness. (It helps also a tiny bit with
build parallelism since now e.g. the cpp files in MCTargetDesc can build after
just 3 .inc files are generated instead of being blocked on all 13. But it's
not a big win, since things depending on Target still need to wait for all 11,
even though all .inc file use is internal to lib/Target.)

Also add a build file for llc, since now all its dependencies have build files.

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

llvm-svn: 348903

5 years ago[codeview] Look through typedefs in getCompleteTypeIndex
Reid Kleckner [Tue, 11 Dec 2018 23:07:39 +0000 (23:07 +0000)]
[codeview] Look through typedefs in getCompleteTypeIndex

Summary:
Any time a symbol record, whether it's S_UDT, S_LOCAL, or S_[GL]DATA32,
references a record type, it should use the complete type index, even if
there's a typedef in the way.

Fixes the compiler part of PR39853.

Reviewers: zturner, aganea

Subscribers: hiraditya, arphaman, llvm-commits

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

llvm-svn: 348902

5 years agoRemove unused file
Jonas Devlieghere [Tue, 11 Dec 2018 22:46:56 +0000 (22:46 +0000)]
Remove unused file

I removed the dotest-style reproducer test but forgot to delete the
source file. Thanks Jim for the heads up!

llvm-svn: 348901

5 years ago[GISel] Add parentheses to an assert because gcc is mean.
Craig Topper [Tue, 11 Dec 2018 22:07:06 +0000 (22:07 +0000)]
[GISel] Add parentheses to an assert because gcc is mean.

llvm-svn: 348900

5 years agoReplace Const-Member checking with non-recursive version.
Erich Keane [Tue, 11 Dec 2018 21:54:52 +0000 (21:54 +0000)]
Replace Const-Member checking with non-recursive version.

As reported in PR39946, these two implementations cause stack overflows
to occur when a type recursively contains itself.  While this only
happens when an incomplete version of itself is used by membership (and
thus an otherwise invalid program), the crashes might be surprising.

The solution here is to replace the recursive implementation with one
that uses a std::vector as a queue.  Old values are kept around to
prevent re-checking already checked types.

Change-Id: I582bb27147104763d7daefcfee39d91f408b9fa8
llvm-svn: 348899

5 years ago Revert "debuginfo: Use symbol difference for CU length to simplify assembly reading...
Jordan Rupprecht [Tue, 11 Dec 2018 21:26:52 +0000 (21:26 +0000)]
 Revert "debuginfo: Use symbol difference for CU length to simplify assembly reading/editing"

Temporarily reverts commit r348806 due to strange asm compilation issues in certain modes (combination of asan+cuda+other things). Will provide repro soon.

llvm-svn: 348898

5 years ago[coroutines] Improve suspend point simplification
Gor Nishanov [Tue, 11 Dec 2018 21:23:09 +0000 (21:23 +0000)]
[coroutines] Improve suspend point simplification

Summary:
Enable suspend point simplification for cases where:
* coro.save and coro.suspend are in different basic blocks
* where there are intervening intrinsics

Reviewers: modocache, tks2103, lewissbaker

Reviewed By: modocache

Subscribers: EricWF, llvm-commits

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

llvm-svn: 348897

5 years ago[Debuginfo] Prevent CodeGenPrepare from dropping debuginfo references.
Wolfgang Pieb [Tue, 11 Dec 2018 21:13:53 +0000 (21:13 +0000)]
[Debuginfo] Prevent CodeGenPrepare from dropping debuginfo references.

This fixes PR39845. CodeGenPrepare employs a transactional model when
performing optimizations, i.e. it changes the IR to attempt an optimization
and rolls back the change when it finds the change inadequate. It is during
the rollback that references to locals were dropped from debug value
intrinsics. This patch reinstates debuginfo references during rollbacks.

Reviewers: aprantl, vsk

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

llvm-svn: 348896

5 years ago[ConstantFolding] Handle leading zero-size elements in load folding
Nikita Popov [Tue, 11 Dec 2018 20:29:16 +0000 (20:29 +0000)]
[ConstantFolding] Handle leading zero-size elements in load folding

Struct types may have leading zero-size elements like [0 x i32], in
which case the "real" element at offset 0 will not necessarily coincide
with the 0th element of the aggregate. ConstantFoldLoadThroughBitcast()
wants to drill down the element at offset 0, but currently always picks
the 0th aggregate element to do so. This patch changes the code to find
the first non-zero-size element instead, for the struct case.

The motivation behind this change is https://github.com/rust-lang/rust/issues/48627.
Rust is fond of emitting [0 x iN] separators between struct elements to
enforce alignment, which prevents constant folding in this particular case.

The additional tests with [4294967295 x [0 x i32]] check that we don't
end up unnecessarily looping over a large number of zero-size elements
of a zero-size array.

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

llvm-svn: 348895

5 years ago[Driver] Simplify OptionData. NFC
Jonas Devlieghere [Tue, 11 Dec 2018 20:19:53 +0000 (20:19 +0000)]
[Driver] Simplify OptionData. NFC

Hopefully this makes the option data easier to understand and maintain.

 - Group the member variables.
 - Do the initialization in the header as it's less error prone.
 - Rename the Clean method. It was called only once and was
   re-initializing some but not all (?) members. The only useful thing it
   does is dealing with the local lldbinit file so keep that and make the
   name reflect that.

llvm-svn: 348894

5 years ago[GISel]: Add MachineIRBuilder support for passing in Flags while building
Aditya Nandakumar [Tue, 11 Dec 2018 20:04:40 +0000 (20:04 +0000)]
[GISel]: Add MachineIRBuilder support for passing in Flags while building

https://reviews.llvm.org/D55516

Add the ability to pass in flags to buildInstr calls. Currently no
validation is performed but that can be easily performed based on the
opcode (if necessary).

Reviewed by: paquette.

llvm-svn: 348893

5 years agoRevert r348889; it fails some tests.
Aaron Ballman [Tue, 11 Dec 2018 19:42:04 +0000 (19:42 +0000)]
Revert r348889; it fails some tests.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/40784

llvm-svn: 348892

5 years agoStop stripping comments from AST matcher example code.
Aaron Ballman [Tue, 11 Dec 2018 19:30:49 +0000 (19:30 +0000)]
Stop stripping comments from AST matcher example code.

The AST matcher documentation dumping script was being a bit over-zealous about stripping comment markers, which ended up causing comments in example code to stop being comments. Fix that by only stripping comments at the start of a line, rather than removing any forward slash (which also impacts prose text).

llvm-svn: 348891

5 years agoAdd ObjectFileBreakpad.{cpp,h} to the Xcode project.
Jim Ingham [Tue, 11 Dec 2018 19:25:03 +0000 (19:25 +0000)]
Add ObjectFileBreakpad.{cpp,h} to the Xcode project.

llvm-svn: 348890

5 years agoEmit -Wformat properly for bit-field promotions.
Aaron Ballman [Tue, 11 Dec 2018 19:18:01 +0000 (19:18 +0000)]
Emit -Wformat properly for bit-field promotions.

Only explicitly look through integer and floating-point promotion where the result type is actually a promotion, which is not always the case for bit-fields in C.

llvm-svn: 348889

5 years ago[Sanitizer] Expand FSEEK interception to FreeBSD
David Carlier [Tue, 11 Dec 2018 19:08:40 +0000 (19:08 +0000)]
[Sanitizer] Expand FSEEK interception to FreeBSD

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 348888

5 years ago[NewPM] fixing asserts on deleted loop in -print-after-all
Fedor Sergeev [Tue, 11 Dec 2018 19:05:35 +0000 (19:05 +0000)]
[NewPM] fixing asserts on deleted loop in -print-after-all

IR-printing AfterPass instrumentation might be called on a loop
that has just been invalidated. We should skip printing it to
avoid spurious asserts.

Reviewed By: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D54740

llvm-svn: 348887