1. Jul 17, 2020
    • Cullen Rhodes's avatar
      [Sema][AArch64] Add parsing support for arm_sve_vector_bits attribute · bb160e76
      Cullen Rhodes authored
      Summary:
      
      This patch implements parsing support for the 'arm_sve_vector_bits' type
      attribute, defined by the Arm C Language Extensions (ACLE, version 00bet5,
      section 3.7.3) for SVE [1].
      
      The purpose of this attribute is to define fixed-length (VLST) versions
      of existing sizeless types (VLAT). For example:
      
          #if __ARM_FEATURE_SVE_BITS==512
          typedef svint32_t fixed_svint32_t __attribute__((arm_sve_vector_bits(512)));
          #endif
      
      Creates a type 'fixed_svint32_t' that is a fixed-length version of
      'svint32_t' that is normal-sized (rather than sizeless) and contains
      exactly 512 bits. Unlike 'svint32_t', this type can be used in places
      such as structs and arrays where sizeless types can't.
      
      Implemented in this patch is the following:
      
        * Defined and tested attribute taking single argument.
        * Checks the argument is an integer constant expression.
        * Attribute can only be attached to a single SVE vector or predicate
          type, excluding tuple types such as svint32x4_t.
        * Added the `-msve-vector-bits=<bits>` flag. When specified the
          `__ARM_FEATURE_SVE_BITS__EXPERIMENTAL` macro is defined.
        * Added a language option to store the vector size specified by the
          `-msve-vector-bits=<bits>` flag. This is used to validate `N ==
          __ARM_FEATURE_SVE_BITS`, where N is the number of bits passed to the
          attribute and `__ARM_FEATURE_SVE_BITS` is the feature macro defined under
          the same flag.
      
      The `__ARM_FEATURE_SVE_BITS` macro will be made non-experimental in the final
      patch of the series.
      
      [1] https://developer.arm.com/documentation/100987/latest
      
      This is patch 1/4 of a patch series.
      
      Reviewers: sdesmalen, rsandifo-arm, efriedma, ctetreau, cameron.mcinally, rengolin, aaron.ballman
      
      Reviewed By: sdesmalen, aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D83550
      bb160e76
    • Jay Foad's avatar
      [MachineScheduler] Fix the TopDepth/BotHeightReduce latency heuristics · 62fd7f76
      Jay Foad authored
      tryLatency compares two sched candidates. For the top zone it prefers
      the one with lesser depth, but only if that depth is greater than the
      total latency of the instructions we've already scheduled -- otherwise
      its latency would be hidden and there would be no stall.
      
      Unfortunately it only tests the depth of one of the candidates. This can
      lead to situations where the TopDepthReduce heuristic does not kick in,
      but a lower priority heuristic chooses the other candidate, whose depth
      *is* greater than the already scheduled latency, which causes a stall.
      
      The fix is to apply the heuristic if the depth of *either* candidate is
      greater than the already scheduled latency.
      
      All this also applies to the BotHeightReduce heuristic in the bottom
      zone.
      
      Differential Revision: https://reviews.llvm.org/D72392
      62fd7f76
    • Pavel Labath's avatar
      [lldb/DWARF] Don't get confused by line sequences with tombstone values · f3fab392
      Pavel Labath authored
      Summary:
      With D81784, lld has started debug info resolving relocations to
      garbage-collected symbols as -1 (instead of relocation addend). For an
      unaware consumer this generated sequences which seemingly wrap the
      address space -- their first entry was 0xfffff, but all other entries
      were low numbers.
      
      Lldb stores line sequences concatenated into one large vector, sorted by
      the first entry, and searched with std::lower_bound. This resulted in
      the low-value entries being placed at the end of the vector, which
      utterly confused the lower_bound algorithm, and caused it to not find a
      match. (Previously, these sequences would be at the start of the vector,
      and normally would contain addresses that are far smaller than any real
      address we want to look up, so std::lower_bound was fine.)
      
      This patch makes lldb ignore these kinds of sequences completely. It
      does that by changing the construction algorithm from iterating over the
      rows (as parsed by llvm), to iterating over the sequences. This is
      important because the llvm parsed performs validity checks when
      constructing the sequence array, whereas the row array contains raw
      data.
      
      Reviewers: JDevlieghere, MaskRay
      
      Differential Revision: https://reviews.llvm.org/D83957
      f3fab392
    • Vitaly Buka's avatar
      [asan] Dedup MemToShadowSize · e412cc40
      Vitaly Buka authored
      Added D83247 and D84004.
      e412cc40
    • Florian Hahn's avatar
      [ScheduleDAG] Move DBG_VALUEs after first term forward. · e297006d
      Florian Hahn authored
      MBBs are not allowed to have non-terminator instructions after the first
      terminator. Currently in some cases (see the modified test),
      EmitSchedule can add DBG_VALUEs after the last terminator, for example
      when referring a debug value that gets folded into a TCRETURN
      instruction on ARM.
      
      This patch updates EmitSchedule to move inserted DBG_VALUEs just before
      the first terminator. I am not sure if there are terminators produce
      values that can in turn be used by a DBG_VALUE. In that case, moving the
      DBG_VALUE might result in referencing an undefined register. But in any
      case, it seems like currently there is no way to insert a proper DBG_VALUEs
      for such registers anyways.
      
      Alternatively it might make sense to just remove those extra DBG_VALUES.
      
      I am not too familiar with the details of debug info in the backend and
      would appreciate any suggestions on how to address the issue in the best
      possible way.
      
      Reviewers: vsk, aprantl, jpaquette, efriedma, paquette
      
      Reviewed By: aprantl
      
      Differential Revision: https://reviews.llvm.org/D83561
      e297006d
    • Vitaly Buka's avatar
      [msan] Fix strxfrm test · 650baf22
      Vitaly Buka authored
      Revert D83719 and explicitly set locate to "C".
      650baf22
    • Vitaly Buka's avatar
      02c74907
    • Vitaly Buka's avatar
      [gwp-asan] Fix check-all with LIT_FILTER · 05fe0697
      Vitaly Buka authored
      05fe0697
    • Vitaly Buka's avatar
      [sanitizer] Fix protoent without network · 40a073ea
      Vitaly Buka authored
      40a073ea
    • Kai Luo's avatar
      [PowerPC] Precommit test case for PR46759. NFC. · 817767ab
      Kai Luo authored
      817767ab
    • Marco Elver's avatar
      [TSan] Add option for emitting compound read-write instrumentation · 785d41a2
      Marco Elver authored
      This adds option -tsan-compound-read-before-write to emit different
      instrumentation for the write if the read before that write is omitted
      from instrumentation. The default TSan runtime currently does not
      support the different instrumentation, and the option is disabled by
      default.
      
      Alternative runtimes, such as the Kernel Concurrency Sanitizer (KCSAN)
      can make use of the feature. Indeed, the initial motivation is for use
      in KCSAN as it was determined that due to the Linux kernel having a
      large number of unaddressed data races, it makes sense to improve
      performance and reporting by distinguishing compounded operations. E.g.
      the compounded instrumentation is typically emitted for compound
      operations such as ++, +=, |=, etc. By emitting different reports, such
      data races can easily be noticed, and also automatically bucketed
      differently by CI systems.
      
      Reviewed By: dvyukov, glider
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D83867
      785d41a2
    • Rainer Orth's avatar
      [compiler-rt][asan] Define MemToShadowSize for sparc64 · 0db3ac33
      Rainer Orth authored
      [compiler-rt][asan][hwasan] Refactor shadow setup into sanitizer_common (NFCI) <https://reviews.llvm.org/D83247>
      broke the Solaris/sparcv9 <http://lab.llvm.org:8014/builders/clang-solaris11-sparcv9/builds/6623> build:
      
        FAILED: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o
        /opt/llvm-buildbot/bin/c++  -D_DEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/asan -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan -Iinclude -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/Support/Solaris -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3     -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -UNDEBUG -std=c++14 -MD -MT projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o -MF projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o.d -o projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.sparcv9.dir/asan_linux.cpp.o -c /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp
        /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp: In function ‘__sanitizer::uptr __asan::FindDynamicShadowStart()’:
        /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp:103:28: error: ‘MemToShadowSize’ was not declared in this scope
           uptr shadow_size_bytes = MemToShadowSize(kHighMemEnd);
                                    ^~~~~~~~~~~~~~~
        /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/asan/asan_linux.cpp:103:28: note: suggested alternative: ‘MemToShadow’
           uptr shadow_size_bytes = MemToShadowSize(kHighMemEnd);
                                    ^~~~~~~~~~~~~~~
                                    MemToShadow
      
      Fixed by also definining `MemToShadowSize` in `compiler-rt/lib/asan/asan_mapping_sparc64.h`.
      
      Tested on `sparcv9-sun-solaris2.11`.
      
      Differential Revision: https://reviews.llvm.org/D84004
      0db3ac33
    • Simon Wallis's avatar
      [ARM] halfword store hits llvm_unreachable with big-endian · 3e0ccf9a
      Simon Wallis authored
      Summary:
      [ARM] halfword store hits llvm_unreachable with big-endian
      
      Provide missing case in getFixupKindContainerSizeBytes().
      
      This stops execution reaching llvm_unreachable("Unknown fixup kind!")
      
      D83947
      
      Reviewers: olista01, ostannard
      
      Reviewed By: ostannard
      
      Subscribers: ostannard, kristof.beyls, hiraditya, danielkiss, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D83947
      
      Change-Id: I598aa1fb51fd1c6f424c557c85d6df6d1958bc62
      3e0ccf9a
    • Raphael Isemann's avatar
      [lldb] Store StackFrameRecognizers in the target instead of a global list · 1b7c9eae
      Raphael Isemann authored
      Summary:
      
      Currently the frame recognizers are stored in a global list (the list in the
      StackFrameRecognizersManagerImpl singleton to be precise). All commands and
      plugins that modify the list are just modifying that global list of recognizers
      which is shared by all Target and Debugger instances.
      
      This is clearly against the idea of LLDB being usable as a library and it also
      leads to some very obscure errors as now multiple tests are sharing the used
      frame recognizers. For example D83400 is currently failing as it reorders some
      test_ functions which permanently changes the frame recognizers of all
      debuggers/targets. As all frame recognizers are also initialized in a 'once'
      guard, it's also impossible to every restore back the original frame recognizers
      once they are deleted in a process.
      
      This patch just moves the frame recognizers into the current target. This seems
      the way everyone assumes the system works as for example the assert frame
      recognizers is using the current target to find the function/so-name to look for
      (which only works if the recognizers are stored in the target).
      
      Reviewers: jingham, mib
      
      Reviewed By: jingham, mib
      
      Subscribers: MrHate, JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D83757
      1b7c9eae
    • Siva Chandra Reddy's avatar
    • Vitaly Buka's avatar
      dbf39e54
    • Vitaly Buka's avatar
      [profile] Enabled test on windows · 1cb8cc1f
      Vitaly Buka authored
      Works with D34797
      1cb8cc1f
    • Max Kazantsev's avatar
      [InstCombine] Fix replace select with Phis when branch has the same labels · c9898810
      Max Kazantsev authored
      ```
      define i32 @test(i1 %cond) {
      entry:
        br i1 %cond, label %exit, label %exit
      exit:
        %result = select i1 %cond, i32 123, i32 456
        ret i32 %result
      }
      ```
      In this test, after applying transformation of replacing select with Phis,
      the result will be:
      
      ```
      define i32 @test(i1 %cond) {
      entry:
        br i1 %cond, label %exit, label %exit
      exit:
        %result = i32 phi [123, %exit], [123, %exit]
        ret i32 %result
      }
      ```
      That is, select is transformed into an invalid Phi, which will then be
      reduced to 123 and the second value will be lost. But it is worth
      noting that this problem will arise only if select is in the InstCombine
      worklist will be before the branch. Otherwise, InstCombine will replace
      the branch condition with false and transformation will not be applied.
      
      The fix is to check the target labels in the branch condition for equality.
      
      Patch By: Kirill Polushin
      Differential Revision: https://reviews.llvm.org/D84003
      Reviewed By: mkazantsev
      c9898810
    • hsmahesha's avatar
    • Igor Kudrin's avatar
      [DebugInfo] Fix a misleading usage of DWARF forms with DIEExpr. NFCI. · f76a0cd9
      Igor Kudrin authored
      For now, DIEExpr is used only in two places:
      
       1) in the debug info library unit test suite to emit
          a DW_AT_str_offsets_base attribute with the DW_FORM_sec_offset
          form, see dwarfgen::DIE::addStrOffsetsBaseAttribute();
      
       2) in DwarfCompileUnit::addLocationAttribute() to generate the location
          attribute for a TLS variable.
      
      The later case used an incorrect DWARF form of DW_FORM_udata, which
      implies storing an uleb128 value, not a 4/8 byte constant. The generated
      result was as expected because DIEExpr::SizeOf() did not handle the used
      form, but returned the size of the code pointer by default.
      
      The patch fixes the issue by using more appropriate DWARF forms for
      the problematic case and making DIEExpr::SizeOf() more straightforward.
      
      Differential Revision: https://reviews.llvm.org/D83958
      f76a0cd9
    • Raphael Isemann's avatar
      [lldb] Only set the executable module for a target once · 16926115
      Raphael Isemann authored
      Summary:
      
      When we try to find the executable module for our target we don't check
      if we already have an executable module set. This causes that when debugging
      a program that dlopens another executable, LLDB will take that other executable
      as the new executable of the target (which causes that future launches of the
      target will launch the dlopen'd executable instead of the original executable).
      
      This just adds a check that we only set the executable when we haven't already
      found one.
      
      Fixes rdar://63443099
      
      Reviewers: jasonmolenda, jingham, teemperor
      
      Reviewed By: jasonmolenda, teemperor
      
      Subscribers: jingham, JDevlieghere
      
      Differential Revision: https://reviews.llvm.org/D80724
      16926115
    • Craig Topper's avatar
      [X86] Change the scheduler model for 'pentium4' to SandyBridgeModel. · 6bba9583
      Craig Topper authored
      I meant to do this in D83913, but missed it while updating the
      feature list.
      
      Interestingly I think this is disabling the postRA scheduler. But
      it does match our default 64-bit behavior.
      
      Reviewed By: echristo
      
      Differential Revision: https://reviews.llvm.org/D83996
      6bba9583
    • Craig Topper's avatar
      [X86] Reorder how the subtarget map key is created. · addbf732
      Craig Topper authored
      We use a SmallString<512> and attempted to reserve enough space
      for CPU plus Features, but that doesn't account for all the things
      that get added to the string.
      
      Reorder the string so the shortest things go first which shouldn't
      exceed the small size. Finally add the feature string at the end
      which might be long. This should ensure at most one heap allocation
      without needing to use reserve.
      
      I don't know if this matters much in practice, but I was looking
      into something else that will require more code here and noticed
      the odd reserve call.
      addbf732
    • Jonas Devlieghere's avatar
      [llvm] Add RISCVTargetParser.def to the module map · 1b3c25e7
      Jonas Devlieghere authored
      This fixes the modules build.
      1b3c25e7
    • Juneyoung Lee's avatar
      [ValueTracking] Let isGuaranteedNotToBeUndefOrPoison consider noundef · 582901d0
      Juneyoung Lee authored
       This patch adds support for noundef arguments.
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D83752
      582901d0
    • Juneyoung Lee's avatar
      Add a test for D83752 · cd495324
      Juneyoung Lee authored
      cd495324
    • Xing GUO's avatar
      dc65f571
    • Logan Smith's avatar
      [polly][NFC] Add missing 'override's · 5d31d09f
      Logan Smith authored
      5d31d09f
    • Logan Smith's avatar
      [compiler-rt][NFC] Add missing 'override's · 947bf0fd
      Logan Smith authored
      947bf0fd
    • Juneyoung Lee's avatar
      [LangRef] Mention that freeze does not consider aggregate's paddings · fd1f8072
      Juneyoung Lee authored
      Make explicit that freeze does not touch paddings of an aggregate.
      (Relevant comment: https://reviews.llvm.org/D83752#2152550)
      
      This implies that `v = freeze(load p); store v, q` may still leave undef bits
      or poison in memory if `v` is an aggregate, but it still happens for
      non-byte integers such as i1.
      
      Differential Revision: https://reviews.llvm.org/D83927
      fd1f8072
    • Carl Ritson's avatar
      [AMDGPU] Translate s_and/s_andn2 to s_mov in vcc optimisation · 3a186657
      Carl Ritson authored
      When SCC is dead, but VCC is required then replace s_and / s_andn2
      with s_mov into VCC when mask value is 0 or -1.
      
      Reviewed By: rampitec
      
      Differential Revision: https://reviews.llvm.org/D83850
      3a186657
    • Vitaly Buka's avatar
      b128f719
    • Vitaly Buka's avatar
      147a608b
    • Richard Smith's avatar
      Revert "[libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked." · 8ef9e2bf
      Richard Smith authored
      This causes binaries linked with this runtime to crash on startup if
      dlsym uses any of the intercepted functions. (For example, that happens
      when using tcmalloc as the allocator: dlsym attempts to allocate memory
      with malloc, and tcmalloc uses strncmp within its implementation.)
      
      Also revert dependent commit "[libFuzzer] Disable implicit builtin knowledge about memcmp-like functions when -fsanitize=fuzzer-no-link is given."
      
      This reverts commit f78d9fce and 12d1124c.
      8ef9e2bf
    • LLVM GN Syncbot's avatar
      [gn build] Port 9870f774 · f6275ca2
      LLVM GN Syncbot authored
      f6275ca2
    • LLVM GN Syncbot's avatar
      [gn build] Port 0f6220dd · 75e2040e
      LLVM GN Syncbot authored
      75e2040e
    • LLVM GN Syncbot's avatar
      [gn build] Port 0e940d55 · c1cc3a86
      LLVM GN Syncbot authored
      c1cc3a86
    • Nico Weber's avatar
      [gn build] (manually) merge 9870f774 · 0beac5b8
      Nico Weber authored
      0beac5b8
    • Min-Yih Hsu's avatar
      [profile] Move __llvm_profile_raw_version into a separate file · 0f6220dd
      Min-Yih Hsu authored
      Similar to the reason behind moving __llvm_profile_filename into a
      separate file[1]. When users try to use Full LTO with BFD linker to
      generate IR level PGO profile, the __llvm_profile_raw_version variable,
      which is used for marking instrumentation level, generated by frontend
      would somehow conflict with the weak symbol provided by profiling
      runtime.
      
      In most of the cases, BFD linkers will pick profiling runtime's weak symbol
      as the real definition and thus generate the incorrect instrumentation
      level metadata in the final executables.
      
      Moving __llvm_profile_raw_version into a separate file would make
      linkers not seeing the weak symbol in the archive unless the frontend
      doesn't generate one.
      
      [1] https://reviews.llvm.org/D34797
      
      Differential Revision: https://reviews.llvm.org/D83967
      0f6220dd
    • Jon Roelofs's avatar