1. Nov 21, 2017
  2. Nov 20, 2017
    • Simon Dardis's avatar
      [mips] Reorder target specific passes · 1631d6ce
      Simon Dardis authored
      Move the hazard scheduling pass to after the long branch pass, as the
      long branch pass can create forbiddden slot hazards. Rather than complicating
      the implementation of the long branch pass to handle forbidden slot hazards,
      just reorder the passes.
      
      llvm-svn: 318657
      1631d6ce
    • Alexander Richardson's avatar
      [ELF] Fix rewriting of --sysroot in reproducer tars · d6424948
      Alexander Richardson authored
      Summary:
      I noticed that the reproducers files I was getting from building CheriBSD
      didn't work because the --sysroot option was not being rewritten. I've
      updated the test to also verify that the rewritten path matches uses a
      FileCheck capature instead of a {{.+}} regex
      
      Reviewers: ruiu
      
      Reviewed By: ruiu
      
      Subscribers: llvm-commits, emaste
      
      Differential Revision: https://reviews.llvm.org/D40125
      
      llvm-svn: 318656
      d6424948
    • Alexander Richardson's avatar
      [ELF] Fall back to search dirs for linker scripts specified with -T · 1de78471
      Alexander Richardson authored
      Summary:
      This matches the behaviour of ld.bfd:
      https://sourceware.org/binutils/docs/ld/Options.html#Options
      
      If scriptfile does not exist in the current directory, ld looks for it in
      the directories specified by any preceding '-L' options. Multiple '-T'
      options accumulate.
      
      Reviewers: ruiu, grimar
      
      Reviewed By: ruiu, grimar
      
      Subscribers: emaste, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40129
      
      llvm-svn: 318655
      1de78471
    • Kamil Rytarowski's avatar
      Correct return types of NetBSD specific functions · 24194525
      Kamil Rytarowski authored
      The __libc_mutex_lock, __libc_mutex_unlock and __libc_thr_setcancelstate
      functions return int, not void.
      
      This does not seem to introduce a functional change, however it looks
      better with fixed the function prototype.
      
      Sponsored by <The NetBSD Foundation>
      
      llvm-svn: 318654
      24194525
    • Alexander Richardson's avatar
      [ELF][MIPS] Fix crash in LLD when linking code that needs PIC thunks · f4630423
      Alexander Richardson authored
      Summary:
      The bug triggers when the following conditions are met:
          - A thunk is created in a given input section S
          - A linker script is specified
          - There is at least one matcher in the linker script .text section output
            that does not match any of the sections in the input files, before the matcher
            that matches section S.
      
      The issue was found when linking the FreeBSD kernel for MIPS when built
      with -fPIC. Patch by Alfredo Mazzinghi.
      
      Reviewers: ruiu, psmith, atanasyan
      
      Reviewed By: ruiu
      
      Subscribers: peter.smith, emaste, sdardis, krytarowski, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40174
      
      llvm-svn: 318653
      f4630423
    • Jonas Paulsson's avatar
      [SystemZ] Bugfix for handling of subregisters in getRegAllocationHints(). · 12e3a588
      Jonas Paulsson authored
      The 32 bit subreg indices of GR128 registers must also be checked for in
      getRC32().
      
      Review: Ulrich Weigand.
      llvm-svn: 318652
      12e3a588
    • Tony Jiang's avatar
      [PPC] Heuristic to choose between a X-Form VSX ld/st vs a X-Form FP ld/st. · 438bf4a6
      Tony Jiang authored
      The VSX versions have the advantage of a full 64-register target whereas the FP
      ones have the advantage of lower latency and higher throughput. So what we’re
      after is using the faster instructions in low register pressure situations and
      using the larger register file in high register pressure situations.
      
      The heuristic chooses between the following 7 pairs of instructions.
      PPC::LXSSPX vs PPC::LFSX
      PPC::LXSDX vs PPC::LFDX
      PPC::STXSSPX vs PPC::STFSX
      PPC::STXSDX vs PPC::STFDX
      PPC::LXSIWAX vs PPC::LFIWAX
      PPC::LXSIWZX vs PPC::LFIWZX
      PPC::STXSIWX vs PPC::STFIWX
      
      Differential Revision: https://reviews.llvm.org/D38486
      
      llvm-svn: 318651
      438bf4a6
    • Sander de Smalen's avatar
      [AArch64][TableGen] Skip tied result operands for InstAlias · 0c5a29b6
      Sander de Smalen authored
      Summary:
      This patch fixes an issue so that the right alias is printed when the instruction has tied operands. It checks the number of operands in the resulting instruction as opposed to the alias, and then skips over tied operands that should not be printed in the alias.
      
      This allows to generate the preferred assembly syntax for the AArch64 'ins' instruction, which should always be displayed as 'mov' according to the ARM Architecture Reference Manual. Several unit tests have changed as a result, but only to reflect the preferred disassembly. Some other InstAlias patterns (movk/bic/orr) needed a slight adjustment to stop them becoming the default and breaking other unit tests.
      
      Please note that the patch is mostly the same as https://reviews.llvm.org/D29219 which was reverted because of an issue found when running TableGen with the Address Sanitizer. That issue has been addressed in this iteration of the patch.
      
      
      Reviewers: rengolin, stoklund, huntergr, SjoerdMeijer, rovka
      
      Reviewed By: rengolin, SjoerdMeijer
      
      Subscribers: fhahn, aemerson, javed.absar, kristof.beyls, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D40030
      
      llvm-svn: 318650
      0c5a29b6
    • Valery Pykhtin's avatar
      f2fe9725
    • Peter Smith's avatar
      [ARM] For assembler files recognize -Xassembler or -Wa, -mthumb · 931c9fa8
      Peter Smith authored
      Attempt to fix warning picked up by buildbot.
      
      llvm-svn: 318648
      931c9fa8
    • Peter Smith's avatar
      [ARM] For assembler files recognize -Xassembler or -Wa, -mthumb · 3947cb3c
      Peter Smith authored
      The Unified Arm Assembler Language is designed so that the majority of
      assembler files can be assembled for both Arm and Thumb with the choice
      made as a compilation option.
      
      The way this is done in gcc is to pass -mthumb to the assembler with either
      -Wa,-mthumb or -Xassembler -mthumb. This change adds support for these
      options to clang. There is no assembler equivalent of -mno-thumb, -marm or
      -mno-arm so we don't need to recognize these.
      
      Ideally we would do all of the processing in
      CollectArgsForIntegratedAssembler(). Unfortunately we need to change the
      triple and at that point it is too late. Instead we look for the option
      earlier in ComputeLLVMTriple().
          
      Fixes PR34519
          
      Differential Revision: https://reviews.llvm.org/D40127
      
      llvm-svn: 318647
      3947cb3c
    • Kamil Rytarowski's avatar
      Handle NetBSD specific indirection of libpthread functions · 86bff788
      Kamil Rytarowski authored
      Summary:
      Correct handling of three libpthread(3) functions on NetBSD:
      
       - pthread_mutex_lock(3),
       - pthread_mutex_unlock(3),
       - pthread_setcancelstate(3).
      
      Code out of the libpthread(3) context uses the libc symbols:
      
       - __libc_mutex_lock,
       - __libc_mutex_unlock,
       - __libc_thr_setcancelstate.
      
      The threading library (libpthread(3)) defines strong aliases:
      
       - __strong_alias(__libc_mutex_lock,pthread_mutex_lock)
       - __strong_alias(__libc_mutex_unlock,pthread_mutex_unlock)
       - __strong_alias(__libc_thr_setcancelstate,pthread_setcancelstate)
      
      This caused that these functions were invisible to sanitizers on NetBSD.
      Intercept the libc-specific ones and add them as NetBSD-specific aliases
      for the common pthread(3) ones.
      
      NetBSD needs to intercept both functions, as the regularly named ones
      are used internally in libpthread(3).
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: joerg, dvyukov, vitalybuka
      
      Reviewed By: dvyukov
      
      Subscribers: llvm-commits, kubamracek, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D40241
      
      llvm-svn: 318646
      86bff788
    • Gil Rapaport's avatar
      [LV] Model masking in VPlan, introducing VPInstructions · 8b9d1f3c
      Gil Rapaport authored
      This patch adds a new abstraction layer to VPlan and leverages it to model the planned
      instructions that manipulate masks (AND, OR, NOT), introduced during predication.
      
      The new VPValue and VPUser classes model how data flows into, through and out
      of a VPlan, forming the vertices of a planned Def-Use graph. The new
      VPInstruction class is a generic single-instruction Recipe that models a
      planned instruction along with its opcode, operands and users. See
      VectorizationPlan.rst for more details.
      
      Differential Revision: https://reviews.llvm.org/D38676
      
      llvm-svn: 318645
      8b9d1f3c
    • Ivan A. Kosarev's avatar
      [Driver] Add a cc1 flag for the new TBAA metadata format · fa03a6a0
      Ivan A. Kosarev authored
      This patch starts a series of changes to add support for the new
      TBAA metadata format proposed in this llvm-dev thread:
      
      http://lists.llvm.org/pipermail/llvm-dev/2017-November/118748.html
      
      Differential Revision: https://reviews.llvm.org/D39955
      
      llvm-svn: 318644
      fa03a6a0
    • Diana Picus's avatar
      [ARM GlobalISel] Add test for RSBri. NFC · 3ac50403
      Diana Picus authored
      Add instruction selector test for RSBri, which is derived from
      AsI1_rbin_irs, and make sure it doesn't get mistaken for SUBri, which is
      derived from the very similar AsI1_bin_irs pattern.
      
      llvm-svn: 318643
      3ac50403
    • Diana Picus's avatar
      [ARM GlobalISel] Clean up binary operator tests. NFC · 6db48f7d
      Diana Picus authored
      Remove some of the instruction selector tests for binary operators (and,
      or, xor). These are all derived from the same kind of TableGen pattern,
      AsI1_bin_irs, so there's no point in testing all of them.
      
      llvm-svn: 318642
      6db48f7d
    • Mohammed Agabaria's avatar
      [LV][X86] Support of AVX2 Gathers code generation and update the LV with this · 115f68ea
      Mohammed Agabaria authored
      This patch depends on: https://reviews.llvm.org/D35348
      
      Support of pattern selection of masked gathers of AVX2 (X86\AVX2 code gen)
      Update LoopVectorize to generate gathers for AVX2 processors.
      
      Reviewers: delena, zvi, RKSimon, craig.topper, aaboud, igorb
      
      Reviewed By: delena, RKSimon
      
      Differential Revision: https://reviews.llvm.org/D35772
      
      llvm-svn: 318641
      115f68ea
    • Craig Topper's avatar
      [X86] Regenerate a test with broadcast comments. NFC · 198f7d78
      Craig Topper authored
      llvm-svn: 318640
      198f7d78
    • Max Kazantsev's avatar
      [IRCE] Smart range intersection · 26846786
      Max Kazantsev authored
      In rL316552, we ban intersection of unsigned latch range with signed range check and vice
      versa, unless the entire range check iteration space is known positive. It was a correct
      functional fix that saved us from dealing with ambiguous values, but it also appeared
      to be a very restrictive limitation. In particular, in the following case:
      
        loop:
          %iv = phi i32 [ 0, %preheader ], [ %iv.next, %latch]
          %iv.offset = add i32 %iv, 10
          %rc = icmp slt i32 %iv.offset, %len
          br i1 %rc, label %latch, label %deopt
      
        latch:
          %iv.next = add i32 %iv, 11
          %cond = icmp i32 ult %iv.next, 100
          br it %cond, label %loop, label %exit
      
      Here, the unsigned iteration range is `[0, 100)`, and the safe range for range
      check is `[-10, %len - 10)`. For unsigned iteration spaces, we use unsigned
      min/max functions for range intersection. Given this, we wanted to avoid dealing
      with `-10` because it is interpreted as a very big unsigned value. Semantically, range
      check's safe range goes through unsigned border, so in fact it is two disjoint
      ranges in IV's iteration space. Intersection of such ranges is not trivial, so we prohibited
      this case saying that we are not allowed to intersect such ranges.
      
      What semantics of this safe range actually means is that we can start from `-10` and go
      up increasing the `%iv` by one until we reach `%len - 10` (for simplicity let's assume that
      `%len - 10`  is a reasonably big positive value).
      
      In particular, this safe iteration space includes `0, 1, 2, ..., %len - 11`. So if we were able to return
      safe iteration space `[0, %len - 10)`, we could safely intersect it with IV's iteration space. All
      values in this range are non-negative, so using signed/unsigned min/max for them is unambiguous.
      
      In this patch, we alter the algorithm of safe range calculation so that it returnes a subset of the
      original safe space which is represented by one continuous range that does not go through wrap.
      In order to reach this, we use modified SCEV substraction function. It can be imagined as a function
      that substracts by `1` (or `-1`) as long as the further substraction does not cause a wrap in IV iteration
      space. This allows us to perform IRCE in many situations when we deal with IV space and range check
      of different types (in terms of signed/unsigned).
      
      We apply this approach for both matching and not matching types of IV iteration space and the
      range check. One implication of this is that now IRCE became smarter in detection of empty safe
      ranges. For example, in this case:
        loop:
          %iv = phi i32 [ %begin, %preheader ], [ %iv.next, %latch]
          %iv.offset = sub i32 %iv, 10
          %rc = icmp ult i32 %iv.offset, %len
          br i1 %rc, label %latch, label %deopt
      
        latch:
          %iv.next = add i32 %iv, 11
          %cond = icmp i32 ult %iv.next, 100
          br it %cond, label %loop, label %exit
      
      If `%len` was less than 10 but SCEV failed to trivially prove that `%begin - 10 >u %len- 10`,
      we could end up executing entire loop in safe preloop while the main loop was still generated,
      but never executed. Now, cutting the ranges so that if both `begin - 10` and `%len - 10` overflow,
      we have a trivially empty range of `[0, 0)`. This in some cases prevents us from meaningless optimization.
      
      Differential Revision: https://reviews.llvm.org/D39954
      
      llvm-svn: 318639
      26846786
    • Serguei Katkov's avatar
      [CGP] Fix the crash caused by enable of complex addr mode · 505359f7
      Serguei Katkov authored
      We must collect all AddModes even if they are the same.
      This is due to Original value is different but we need all original
      values collected as they are used as anchors in common phi finding.
      
      Reviewers: john.brawn, reames
      Reviewed By: john.brawn
      Subscribers: llvm-commits
      Differential Revision: https://reviews.llvm.org/D40166
      
      llvm-svn: 318638
      505359f7
    • Peter Collingbourne's avatar
      COFF: Fix invalid comdat sections in test cases. · 8e820552
      Peter Collingbourne authored
      The comdat sections in these test cases do not comply with the COFF
      specification, and link.exe rejects them. I plan to make a change to
      how we handle comdat sections which would also cause us to reject them.
      
      llvm-svn: 318637
      8e820552
    • Peter Collingbourne's avatar
      5c7b467b
    • Peter Collingbourne's avatar
      COFF: Remove unused fields. NFC. · 38e3a1ea
      Peter Collingbourne authored
      llvm-svn: 318635
      38e3a1ea
    • Craig Topper's avatar
      [X86] clzero check in getHostCPUFeatures should use getX86CpuIDAndInfo not getX86CpuIDAndInfoEx. · dcd69797
      Craig Topper authored
      This leaf doesn't take an additional argument.
      
      llvm-svn: 318634
      dcd69797
    • Craig Topper's avatar
      [X86] Reorder and reformat the feature bit checks in getHostCPUFeatues to keep... · 1af7e442
      Craig Topper authored
      [X86] Reorder and reformat the feature bit checks in getHostCPUFeatues to keep the bits in order per register and encourage future additions to be in order too.
      
      llvm-svn: 318633
      1af7e442
    • Philip Pfaffe's avatar
      Port ScopInfo to the isl cpp bindings · 00fd43b3
      Philip Pfaffe authored
      Summary:
      Most changes are mechanical, but in one place I changed the program semantics
      by fixing a likely bug:
      
      In `Scop::hasFeasibleRuntimeContext()`, I'm now explicitely handling the
      error-case. Before, when the call to `addNonEmptyDomainConstraints()`
      returned a null set, this (probably) accidentally worked because
      isl_bool_error converts to true. I'm checking for nullptr now.
      
      Reviewers: grosser, Meinersbur, bollu
      
      Reviewed By: Meinersbur
      
      Subscribers: nemanjai, kbarton, pollydev, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D39971
      
      llvm-svn: 318632
      00fd43b3
    • Jan Kratochvil's avatar
      0f45abde
    • Sanjay Patel's avatar
      [x86] add sqrt tests for partially-inline-libcalls (PR31455) · c0218923
      Sanjay Patel authored
      llvm-svn: 318630
      c0218923
    • Sanjay Patel's avatar
      9771a96f
    • Sanjay Patel's avatar
      [LibCallSimplifier] partly fix pow(x, 0.5) -> sqrt() transforms · fbd3e66b
      Sanjay Patel authored
      As the first test shows, we could transform an llvm intrinsic which never sets errno 
      into a libcall which could set errno (even though it's marked readnone?), so that's 
      not ideal.
      
      It's possible that we can also transform a libcall which could set errno to an
      intrinsic given the fast-math-flags constraint, but that's deferred to determine
      exactly which set of FMF are needed.
      
      Differential Revision: https://reviews.llvm.org/D40150
      
      llvm-svn: 318628
      fbd3e66b
  3. Nov 19, 2017
    • Sanjay Patel's avatar
      [InstSimplify] fold and/or of fcmp ord/uno when operand is known nnan · eb731b09
      Sanjay Patel authored
      The 'ord' and 'uno' predicates have a logic operation for NAN built into their definitions:
      
      FCMP_ORD   =  7,  ///< 0 1 1 1    True if ordered (no nans)
      FCMP_UNO   =  8,  ///< 1 0 0 0    True if unordered: isnan(X) | isnan(Y)
      
      So we can simplify patterns like this:
      
      (fcmp ord (known NNAN), X) && (fcmp ord X, Y) --> fcmp ord X, Y
      (fcmp uno (known NNAN), X) || (fcmp uno X, Y) --> fcmp uno X, Y
      
      It might be better to split this into (X uno 0) | (Y uno 0) as a canonicalization, but that
      would be another patch.
      
      Differential Revision: https://reviews.llvm.org/D40130 
      
      llvm-svn: 318627
      eb731b09