1. Jun 07, 2019
    • Nico Weber's avatar
      95dd67ac
    • Peter Smith's avatar
      [ELF][AArch64] Support for BTI and PAC · e208208a
      Peter Smith authored
      Branch Target Identification (BTI) and Pointer Authentication (PAC) are
      architecture features introduced in v8.5a and 8.3a respectively. The new
      instructions have been added in the hint space so that binaries take
      advantage of support where it exists yet still run on older hardware. The
      impact of each feature is:
      
      BTI: For executable pages that have been guarded, all indirect branches
      must have a destination that is a BTI instruction of the appropriate type.
      For the static linker, this means that PLT entries must have a "BTI c" as
      the first instruction in the sequence. BTI is an all or nothing
      property for a link unit, any indirect branch not landing on a valid
      destination will cause a Branch Target Exception.
      
      PAC: The dynamic loader encodes with PACIA the address of the destination
      that the PLT entry will load from the .plt.got, placing the result in a
      subset of the top-bits that are not valid virtual addresses. The PLT entry
      may authenticate these top-bits using the AUTIA instruction before
      branching to the destination. Use of PAC in PLT sequences is a contract
      between the dynamic loader and the static linker, it is independent of
      whether the relocatable objects use PAC.
      
      BTI and PAC are independent features that can be combined. So we can have
      several combinations of PLT:
      - Standard with no BTI or PAC
      - BTI PLT with "BTI c" as first instruction.
      - PAC PLT with "AUTIA1716" before the indirect branch to X17.
      - BTIPAC PLT with "BTI c" as first instruction and "AUTIA1716" before the
        first indirect branch to X17.
          
      The use of BTI and PAC in relocatable object files are encoded by feature
      bits in the .note.gnu.property section in a similar way to Intel CET. There
      is one AArch64 specific program property GNU_PROPERTY_AARCH64_FEATURE_1_AND
      and two target feature bits defined:
      - GNU_PROPERTY_AARCH64_FEATURE_1_BTI
      -- All executable sections are compatible with BTI.
      - GNU_PROPERTY_AARCH64_FEATURE_1_PAC
      -- All executable sections have return address signing enabled.
      
      Due to the properties of FEATURE_1_AND the static linker can tell when all
      input relocatable objects have the BTI and PAC feature bits set. The static
      linker uses this to enable the appropriate PLT sequence.
      Neither -> standard PLT
      GNU_PROPERTY_AARCH64_FEATURE_1_BTI -> BTI PLT
      GNU_PROPERTY_AARCH64_FEATURE_1_PAC -> PAC PLT
      Both properties -> BTIPAC PLT
      
      In addition to the .note.gnu.properties there are two new command line
      options:
      --force-bti : Act as if all relocatable inputs had
      GNU_PROPERTY_AARCH64_FEATURE_1_BTI and warn for every relocatable object
      that does not.
      --pac-plt : Act as if all relocatable inputs had
      GNU_PROPERTY_AARCH64_FEATURE_1_PAC. As PAC is a contract between the loader
      and static linker no warning is given if it is not present in an input.
      
      Two processor specific dynamic tags are used to communicate that a non
      standard PLT sequence is being used.
      DTI_AARCH64_BTI_PLT and DTI_AARCH64_BTI_PAC.
      
      Differential Revision: https://reviews.llvm.org/D62609
      
      llvm-svn: 362793
      e208208a
    • Anton Afanasyev's avatar
      [Support][Test] Time profiler: add regression test · f2ddd608
      Anton Afanasyev authored
      Summary:
      Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
      add regression test checking this option works as expected.
      
      Reviewers: thakis, aganea
      
      Subscribers: cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D61914
      
      llvm-svn: 362792
      f2ddd608
    • Simon Tatham's avatar
      [ARM] Fix bugs introduced by the fp64/d32 rework. · 5d66f2b0
      Simon Tatham authored
      Change D60691 caused some knock-on failures that weren't caught by the
      existing tests. Firstly, selecting a CPU that should have had a
      restricted FPU (e.g. `-mcpu=cortex-m4`, which should have 16 d-regs
      and no double precision) could give the unrestricted version, because
      `ARM::getFPUFeatures` returned a list of features including subtracted
      ones (here `-fp64`,`-d32`), but `ARMTargetInfo::initFeatureMap` threw
      away all the ones that didn't start with `+`. Secondly, the
      preprocessor macros didn't reliably match the actual compilation
      settings: for example, `-mfpu=softvfp` could still set `__ARM_FP` as
      if hardware FP was available, because the list of features on the cc1
      command line would include things like `+vfp4`,`-vfp4d16` and clang
      didn't realise that one of those cancelled out the other.
      
      I've fixed both of these issues by rewriting `ARM::getFPUFeatures` so
      that it returns a list that enables every FP-related feature
      compatible with the selected FPU and disables every feature not
      compatible, which is more verbose but means clang doesn't have to
      understand the dependency relationships between the backend features.
      Meanwhile, `ARMTargetInfo::handleTargetFeatures` is testing for all
      the various forms of the FP feature names, so that it won't miss cases
      where it should have set `HW_FP` to feed into feature test macros.
      
      That in turn caused an ordering problem when handling `-mcpu=foo+bar`
      together with `-mfpu=something_that_turns_off_bar`. To fix that, I've
      arranged that the `+bar` suffixes on the end of `-mcpu` and `-march`
      cause feature names to be put into a separate vector which is
      concatenated after the output of `getFPUFeatures`.
      
      Another side effect of all this is to fix a bug where `clang -target
      armv8-eabi` by itself would fail to set `__ARM_FEATURE_FMA`, even
      though `armv8` (aka Arm v8-A) implies FP-Armv8 which has FMA. That was
      because `HW_FP` was being set to a value including only the `FPARMV8`
      bit, but that feature test macro was testing only the `VFP4FPU` bit.
      Now `HW_FP` ends up with all the bits set, so it gives the right
      answer.
      
      Changes to tests included in this patch:
      
      * `arm-target-features.c`: I had to change basically all the expected
        results. (The Cortex-M4 test in there should function as a
        regression test for the accidental double-precision bug.)
      * `arm-mfpu.c`, `armv8.1m.main.c`: switched to using `CHECK-DAG`
        everywhere so that those tests are no longer sensitive to the order
        of cc1 feature options on the command line.
      * `arm-acle-6.5.c`: been updated to expect the right answer to that
        FMA test.
      * `Preprocessor/arm-target-features.c`: added a regression test for
        the `mfpu=softvfp` issue.
      
      Reviewers: SjoerdMeijer, dmgreen, ostannard, samparker, JamesNagurne
      
      Reviewed By: ostannard
      
      Subscribers: srhines, javed.absar, kristof.beyls, hiraditya, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D62998
      
      llvm-svn: 362791
      5d66f2b0
    • Sam Elliott's avatar
      [RISCV] Support Bit-Preserving FP in F/D Extensions · f720647d
      Sam Elliott authored
      Summary:
      This allows some integer bitwise operations to instead be performed by
      hardware fp instructions. This is correct because the RISC-V spec
      requires the F and D extensions to use the IEEE-754 standard
      representation, and fp register loads and stores to be bit-preserving.
      
      This is tested against the soft-float ABI, but with hardware float
      extensions enabled, so that the tests also ensure the optimisation also
      fires in this case.
      
      Reviewers: asb, luismarques
      
      Reviewed By: asb
      
      Subscribers: hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D62900
      
      llvm-svn: 362790
      f720647d
    • Valery Pykhtin's avatar
      [AMDGPU] Constrain the AMDGPU inliner on maximum number of basic blocks in a... · cb8de55f
      Valery Pykhtin authored
      [AMDGPU] Constrain the AMDGPU inliner on maximum number of basic blocks in a caller function (compile time performance)
      
      Differential revision: https://reviews.llvm.org/D62917
      
      llvm-svn: 362789
      cb8de55f
    • Fangrui Song's avatar
      [ELF] Delete R_PPC64_CALL_PLT from isRelExpr() · 32742d8f
      Fangrui Song authored
      It was added by D46654 but is actually never used.
      R_PPC64_CALL_PLT (was: R_PPC_CALL_PLT) is a static link-time constant.
      
      Reviewed By: ruiu
      
      Differential Revision: https://reviews.llvm.org/D62994
      
      llvm-svn: 362788
      32742d8f
    • Russell Gallop's avatar
      [X86][test] Add test cases using immediates to builtins-x86.c · 4bcba163
      Russell Gallop authored
      These builtins should work with immediate or variable shift operand for
      gcc compatibility.
      
      Differential Revision: https://reviews.llvm.org/D62850
      
      llvm-svn: 362786
      4bcba163
    • Sam McCall's avatar
      [CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods. · f1f6e0fc
      Sam McCall authored
      Summary:
      - when a method is not available because of the target value kind (e.g. an &&
        method on a Foo& variable), then don't offer it.
      - when a method is effectively shadowed by another method from the same class
        with a) an identical argument list and b) superior qualifiers, then don't
        offer it.
      
      Reviewers: ilya-biryukov
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D62582
      
      llvm-svn: 362785
      f1f6e0fc
    • Pavel Labath's avatar
      Fix some signed/unsigned comparison warnings · 15fec3a6
      Pavel Labath authored
      llvm-svn: 362784
      15fec3a6
    • Pavel Labath's avatar
      DWARF: Simplify SymbolFileDWARF::GetDWARFCompileUnit · 62c905a2
      Pavel Labath authored
      Summary:
      The DWARFCompileUnit is set as the "user data" of the lldb compile unit
      directly in the constructor (see ParseCompileUnit).
      
      This means that instead of going through unit indexes, we can just fetch
      the DWARF unit directly from there.
      
      Reviewers: clayborg, JDevlieghere
      
      Subscribers: aprantl, jdoerfert, lldb-commits
      
      Differential Revision: https://reviews.llvm.org/D62943
      
      llvm-svn: 362783
      62c905a2
    • Dmitri Gribenko's avatar
      Work around a circular dependency between IR and MC introduced in r362735 · 5b3c9880
      Dmitri Gribenko authored
      I replaced the circular library dependency with a forward declaration,
      but it is only a workaround, not a real fix.
      
      llvm-svn: 362782
      5b3c9880
    • Pengfei Wang's avatar
      [X86] -march=cooperlake (clang) · 30bcda86
      Pengfei Wang authored
      Support intel -march=cooperlake in clang
      
      Patch by Shengchen Kan (skan)
      
      Differential Revision: https://reviews.llvm.org/D62835
      
      llvm-svn: 362781
      30bcda86
    • Cullen Rhodes's avatar
      [AArch64][AsmParser] error on unexpected SVE predicate type suffix · 1f0d2512
      Cullen Rhodes authored
      Summary:
      This patch fixes a bug in the assembler that permitted a type suffix on
      predicate registers when not expected. For instance, the following was
      previously valid:
      
          faddv h0, p0.q, z1.h
      
      This bug was present in all SVE instructions containing predicates with
      no type suffix and no predication form qualifier, i.e. /z or /m. The
      latter instructions are already caught with an appropiate error message
      by the assembler, e.g.:
      
                  .text
          <stdin>:1:13: error: not expecting size suffix
          cmpne p1.s, p0.b/z, z2.s, 0
                      ^
      
      A similar issue for SVE vector registers was fixed in:
      
        https://reviews.llvm.org/D59636
      
      Reviewed By: SjoerdMeijer
      
      Differential Revision: https://reviews.llvm.org/D62942
      
      llvm-svn: 362780
      1f0d2512
    • Cullen Rhodes's avatar
      [AArch64][AsmParser] Provide better diagnostics for SVE predicates · f7305484
      Cullen Rhodes authored
      Patch by Sander de Smalen (sdesmalen)
      
      Reviewed By: SjoerdMeijer
      
      Differential Revision: https://reviews.llvm.org/D62941
      
      llvm-svn: 362779
      f7305484
    • George Rimar's avatar
      [llvm-objcopy] - Emit error and don't crash if program header reaches past end of file. · 33044a7a
      George Rimar authored
      This is https://bugs.llvm.org/show_bug.cgi?id=42122.
      
      If an object file has a size less than program header's file [offset + size]
      (i.e. if we have overflow), llvm-objcopy crashes instead of reporting a
      error.
      
      The patch fixes this issue.
      
      Differential revision: https://reviews.llvm.org/D62898
      
      llvm-svn: 362778
      33044a7a
    • George Rimar's avatar
      [yaml2elf] - Refactoring followup for D62809 · eb394e93
      George Rimar authored
      This is a refactoring follow-up for D62809
      "Change how we handle implicit sections.".
      It allows to simplify the code.
      
      Differential revision: https://reviews.llvm.org/D62912
      
      llvm-svn: 362777
      eb394e93
    • Pengfei Wang's avatar
      [X86] -march=cooperlake (llvm) · f8b28931
      Pengfei Wang authored
      Support intel -march=cooperlake in llvm
      
      Patch by Shengchen Kan (skan)
      
      Differential Revision: https://reviews.llvm.org/D62836
      
      llvm-svn: 362776
      f8b28931
    • Sam Parker's avatar
      Fix for lld buildbot · 67f9dc60
      Sam Parker authored
      Removed unused (in non-debug builds) variable.
      
      llvm-svn: 362775
      67f9dc60
    • Sam Parker's avatar
      [CodeGen] Generic Hardware Loop Support · c5ef502e
      Sam Parker authored
          
      Patch which introduces a target-independent framework for generating
      hardware loops at the IR level. Most of the code has been taken from
      PowerPC CTRLoops and PowerPC has been ported over to use this generic
      pass. The target dependent parts have been moved into
      TargetTransformInfo, via isHardwareLoopProfitable, with
      HardwareLoopInfo introduced to transfer information from the backend.
          
      Three generic intrinsics have been introduced:
      - void @llvm.set_loop_iterations
        Takes as a single operand, the number of iterations to be executed.
      - i1 @llvm.loop_decrement(anyint)
        Takes the maximum number of elements processed in an iteration of
        the loop body and subtracts this from the total count. Returns
        false when the loop should exit.
      - anyint @llvm.loop_decrement_reg(anyint, anyint)
        Takes the number of elements remaining to be processed as well as
        the maximum numbe of elements processed in an iteration of the loop
        body. Returns the updated number of elements remaining.
      
      llvm-svn: 362774
      c5ef502e
    • Dylan McKay's avatar
      [AVR] Expand 16-bit rotations during the legalization stage · 04b418f2
      Dylan McKay authored
      In r356860, the legalization logic for BSWAP was modified to ISD::ROTL,
      rather than the old ISD::{SHL, SRL, OR} nodes.
      
      This works fine on AVR for 8-bit rotations, but 16-bit rotations are
      currently unimplemented - they always trigger an assertion error in the
      AVRExpandPseudoInsts pass ("RORW unimplemented").
      
      This patch instructions the legalizer to expand 16-bit rotations into
      the previous SHL, SRL, OR pattern it did previously.
      
      This fixes the 'issue-cannot-select-bswap.ll' test. Interestingly, this
      test failure seems flaky - it passes successfully on the avr-build-01
      buildbot, but fails locally on my Arch Linux install.
      
      llvm-svn: 362773
      04b418f2
    • Michael Pozulp's avatar
      [NFC] Delete trailing whitespace character. · 65d1ff8e
      Michael Pozulp authored
      llvm-svn: 362772
      65d1ff8e
    • Michael Pozulp's avatar
      [llvm-objdump] Print source when subsequent lines in the translation unit come... · 767bdd55
      Michael Pozulp authored
      [llvm-objdump] Print source when subsequent lines in the translation unit come from the same line in two different headers.
      
      Reviewers: grimar, rupprecht, jhenderson
      
      Reviewed By: grimar, jhenderson
      
      Subscribers: llvm-commits, jhenderson
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D62461
      
      llvm-svn: 362771
      767bdd55
    • Sam Clegg's avatar
      [lld] Allow args::getInterger to parse args larger than 2^31-1 · 53211aa9
      Sam Clegg authored
      Differential Revision: https://reviews.llvm.org/D62933
      
      llvm-svn: 362770
      53211aa9
    • Sam Clegg's avatar
      [WebAssembly] Fix for discarded init functions · fd54fa5d
      Sam Clegg authored
      When a function is excluded via comdat we shouldn't add it to the
      final list of init functions.
      
      Differential Revision: https://reviews.llvm.org/D62983
      
      llvm-svn: 362769
      fd54fa5d
    • Michael Pozulp's avatar
      [llvm-objdump] Add warning if --disassemble-functions specifies an unknown symbol · 50f61af3
      Michael Pozulp authored
      Summary: Fixes Bug 41904 https://bugs.llvm.org/show_bug.cgi?id=41904
      
      Reviewers: jhenderson, rupprecht, grimar, MaskRay
      
      Reviewed By: jhenderson, rupprecht, MaskRay
      
      Subscribers: dexonsmith, rupprecht, kristina, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D62275
      
      llvm-svn: 362768
      50f61af3
    • Fangrui Song's avatar
      [MC][ELF] Don't create relocations with section symbols for STB_LOCAL ifunc · c841b9ab
      Fangrui Song authored
      We should keep the symbol type (STT_GNU_IFUNC) for a local ifunc because
      it may result in an IRELATIVE reloc that the dynamic loader will use to
      resolve the address at startup time.
      
      There is another problem that is not fixed by this patch: a PC relative
      relocation should also create a relocation with the ifunc symbol.
      
      llvm-svn: 362767
      c841b9ab
    • Michael Pozulp's avatar
      [ADT] Enable set_difference() to be used on StringSet · 0bddef79
      Michael Pozulp authored
      Subscribers: mgorny, mgrang, dexonsmith, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D62992
      
      llvm-svn: 362766
      0bddef79
    • Peter Collingbourne's avatar
      Set an output file name for the override-new-delete.cpp test. · c7903b9f
      Peter Collingbourne authored
      The android_compile.py script requires one.
      
      llvm-svn: 362764
      c7903b9f
    • Michael Pozulp's avatar
      [NFC] Test commit. · c7029e4e
      Michael Pozulp authored
      llvm-svn: 362763
      c7029e4e
    • Fangrui Song's avatar
      [LV] Fix -Wunused-function after r362736 · 19189993
      Fangrui Song authored
      llvm-svn: 362762
      19189993
    • Matt Arsenault's avatar
      AMDGPU: Don't count mask branch pseudo towards skip threshold · c0edb8f5
      Matt Arsenault authored
      llvm-svn: 362761
      c0edb8f5
    • Matt Arsenault's avatar
      AMDGPU: Insert skips for blocks with FLAT · 99ee81b1
      Matt Arsenault authored
      This already forced a skip for VMEM, so it should also be done for
      flat. I'm somewhat skeptical about the benefit of this though.
      
      llvm-svn: 362760
      99ee81b1
    • Nemanja Ivanovic's avatar
      [PowerPC] Exploit the vector min/max instructions · ef4a3aa5
      Nemanja Ivanovic authored
      Use the PPC vector min/max instructions for computing the corresponding
      operation as these should be faster than the compare/select sequences
      we currently emit.
      
      Differential revision: https://reviews.llvm.org/D47332
      
      llvm-svn: 362759
      ef4a3aa5
    • Mitch Phillips's avatar
      Change GWP-ASan build to use '-pthread' instead of '-lpthread' in order · e41e366a
      Mitch Phillips authored
      to try and fix android buildbot. Also make sure that the empty dummy
      test contains an output file name so the android_build.py wrapper script
      doesn't check fail.
      
      llvm-svn: 362758
      e41e366a
    • Richard Smith's avatar
      Factor out duplicated code building a MemberExpr and marking it · 84be9984
      Richard Smith authored
      referenced.
      
      This reinstates r362563, reverted in r362597.
      
      llvm-svn: 362757
      84be9984
    • Richard Smith's avatar
      Convert MemberExpr creation and serialization to work the same way as · dcf17ded
      Richard Smith authored
      most / all other Expr subclasses.
      
      This reinstates r362551, reverted in r362597, with a fix to a bug that
      caused MemberExprs to sometimes have a null FoundDecl after a round-trip
      through an AST file.
      
      llvm-svn: 362756
      dcf17ded
    • Jordan Rupprecht's avatar
      Revert [ELF] Simplify the condition to create .interp · 0629e125
      Jordan Rupprecht authored
      This reverts r362355 (git commit c78c999a)
      
      This causes some internal tests to fail; details provided offthread.
      
      llvm-svn: 362755
      0629e125
    • Matt Arsenault's avatar
      AMDGPU: Insert skip branches over return blocks · b6cfa129
      Matt Arsenault authored
      SIInsertSkips really doesn't understand the control flow, and makes
      very stupid assumptions about the block layout. This was able to get
      away with not skipping return blocks, since usually after
      structurization there is only one placed at the end of the
      function. Tail duplication can break this assumption.
      
      llvm-svn: 362754
      b6cfa129
    • David Tenty's avatar
      [NFC] Test commit, whitespace change · b82ea52b
      David Tenty authored
      As per the Developer Policy, upon obtaining commit access.
      
      llvm-svn: 362753
      b82ea52b