1. Feb 13, 2020
    • Florian Hahn's avatar
      Recommit "[SCCP] Remove forcedconstant, go to overdefined instead" · bb310b3f
      Florian Hahn authored
      This version includes a fix for a set of crashes caused by marking
      values depending on a yet unknown & tracked call as overdefined.
      
      In some cases, we would later discover that the call has a constant
      result and try to mark a user of it as constant, although it was already
      marked as overdefined. Most instruction handlers bail out early if the
      instruction is already overdefined. But that is not necessary for
      CastInsts for example. By skipping values that depend on skipped
      calls, we resolve the crashes and also improve the precision in some
      cases (see resolvedundefsin-tracked-fn.ll).
      
      Note that we may not skip PHI nodes that may depend on a skipped call,
      but they can be safely marked as overdefined, as we bail out early if
      the PHI node is overdefined.
      
      This reverts the revert commit
      a74b31a3e9cd844c7ce2087978568e3f5ec8519.
      bb310b3f
    • David Green's avatar
      5bb49540
    • Anh Tuyen Tran's avatar
      [NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files · a5b6480d
      Anh Tuyen Tran authored
      Summary:
      This refactor patch removes some header files which are not needed and also add some to meet IWYU principles.
      
      Reviewers: rnk (Reid Kleckner), Meinersbur (Michael Kruse), dmgreen (Dave Green)
      
      Reviewed By: dmgreen (Dave Green), rnk (Reid Kleckner), Meinersbur (Michael Kruse)
      
      Subscribers: dmgreen (Dave Green), Whitney (Whitney Tsang), hiraditya (Aditya Kumar), zzheng (Z. Zheng), llvm-commits, LLVM
      
      Tag: LLVM
      
      Differential Revision: https://reviews.llvm.org/D73498
      a5b6480d
    • River Riddle's avatar
      [mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument> · c8321459
      River Riddle authored
      Summary: This was a missed case when ValueRange was originally added, and allows for constructing a ValueRange from the arguments of a block.
      
      Differential Revision: https://reviews.llvm.org/D74363
      c8321459
    • Shoaib Meenai's avatar
      [runtimes] Add umbrella targets for runtimes · 26edb21c
      Shoaib Meenai authored
      This will create e.g. a compiler-rt target that'll build compiler-rt for
      all configured targets, similar to how the runtimes umbrella target
      builds all the runtimes for all configured targets.
      
      Differential Revision: https://reviews.llvm.org/D74458
      26edb21c
    • Michael Liao's avatar
      Fix `-Wunused-variable` warning. NFC. · f6a3ac15
      Michael Liao authored
      f6a3ac15
    • Jessica Paquette's avatar
      [AArch64][GlobalISel] Properly implement widening for TB(N)Z · 45417b7a
      Jessica Paquette authored
      When we have to widen to a 64-bit register, we have to emit a SUBREG_TO_REG.
      
      Add a general-purpose widening helpe  which emits the correct SUBREG_TO_REG
      instruction based off of a desired size and add a testcase.
      
      Also remove some asserts which are technically incorrect in `emitTestBit`.
      
      - p0 doesn't count as a scalar type, so we need to check `!Ty.isVector()`
      instead
      
      - Whenever we have a s1, the Size/Bit checks are too conservative, so just
      remove them
      
      Replace these asserts with less conservative ones where applicable.
      
      Differential Revision: https://reviews.llvm.org/D74427
      45417b7a
    • Alina Sbirlea's avatar
      Compute ORE, BPI, BFI in Loop passes. · 4f33a689
      Alina Sbirlea authored
      Summary:
      Passes ORE, BPI, BFI are not being preserved by Loop passes, hence it
      is incorrect to retrieve these passes as cached.
      This patch makes the loop passes in question compute a new instance.
      
      In some of these cases, however, it may be beneficial to change the Loop pass to
      a Function pass instead, similar to the change for LoopUnrollAndJam.
      
      Reviewers: chandlerc, dmgreen, jdoerfert, reames
      
      Subscribers: mehdi_amini, hiraditya, zzheng, steven_wu, dexonsmith, Whitney, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72891
      4f33a689
    • Matt Arsenault's avatar
      clang: Guess at some platform FTZ/DAZ default settings · fa7cd549
      Matt Arsenault authored
      This is to avoid performance regressions when the default attribute
      behavior is fixed to assume ieee.
      
      I tested the default on x86_64 ubuntu, which seems to default to
      FTZ/DAZ, but am guessing for x86 and PS4.
      fa7cd549
    • Sanjay Patel's avatar
      2452f85b
    • Justin Lebar's avatar
      Fix SFINAE in llvm::bit_cast. · bc316c21
      Justin Lebar authored
      Summary:
      As far as I can tell, the SFINAE was broken; there is no such thing as
      std::is_trivially_constructible<T>::type.
      
      Subscribers: dexonsmith, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74380
      bc316c21
    • Justin Lebar's avatar
      Fix compilation of Any.h header. · 17b77418
      Justin Lebar authored
      In a previous patch I changed `std::decay<T>::type` to `std::decay<T>`
      rather than `std::decay_t<T>`.  This seems to have broken the build
      *only for clang-cl*.  I don't know why.
      
      Submitting with post-commit review because this is an obvious fix for a
      build breakage and we've verified that it fixes the breakage.
      17b77418
    • Fangrui Song's avatar
      [ELF] Support INSERT [AFTER|BEFORE] for orphan sections · 7c426fb1
      Fangrui Song authored
      D43468+D44380 added INSERT [AFTER|BEFORE] for non-orphan sections. This patch
      makes INSERT work for orphan sections as well.
      
      `SECTIONS {...} INSERT [AFTER|BEFORE] .foo` does not set `hasSectionCommands`, so the result
      will be similar to a regular link without a linker script. The differences when `hasSectionCommands` is set include:
      
      * image base is different
      * -z noseparate-code/-z noseparate-loadable-segments are unavailable
      * some special symbols such as `_end _etext _edata` are not defined
      
      The behavior is similar to GNU ld:
      INSERT is not considered an external linker script.
      
      This feature makes the section layout more flexible. It can be used to:
      
      * Place .nv_fatbin before other readonly SHT_PROGBITS sections to mitigate relocation overflows.
      * Disturb the layout to expose address sensitive application bugs.
      
      Reviewed By: grimar
      
      Differential Revision: https://reviews.llvm.org/D74375
      7c426fb1
    • Fangrui Song's avatar
      [ELF] Start a new PT_LOAD if LMA region is different · b498d993
      Fangrui Song authored
      GNU ld has a counterintuitive lang_propagate_lma_regions rule.
      
      ```
      // .foo's LMA region is propagated to .bar because their VMA region is the same,
      // and .bar does not have an explicit output section address (addr_tree).
      .foo : { *(.foo) } >RAM AT> FLASH
      .bar : { *(.bar) } >RAM
      
      // An explicit output section address disables propagation.
      .foo : { *(.foo) } >RAM AT> FLASH
      .bar . : { *(.bar) } >RAM
      ```
      
      In both cases, lld thinks .foo's LMA region is propagated and
      places .bar in the same PT_LOAD, so lld diverges from GNU ld w.r.t. the
      second case (lma-align.test).
      
      This patch changes Writer<ELFT>::createPhdrs to disable propagation
      (start a new PT_LOAD). A user of the first case can make linker scripts
      portable by explicitly specifying `AT>`. By contrast, there was no
      workaround for the old behavior.
      
      This change uncovers another LMA related bug in assignOffsets() where
      `ctx->lmaOffset = 0;` was omitted. It caused a spurious "load address
      range overlaps" error for at2.test
      
      The new PT_LOAD rule is complex. For convenience, I listed the origins of some subexpressions:
      
      * rL323449: `sec->memRegion == load->firstSec->memRegion`; linkerscript/at3.test
      * D43284: `load->lastSec == Out::programHeaders` (don't start a new PT_LOAD after program headers); linkerscript/at4.test
      * D58892: `sec != relroEnd` (start a new PT_LOAD after PT_GNU_RELRO)
      
      Reviewed By: psmith
      
      Differential Revision: https://reviews.llvm.org/D74297
      b498d993
    • Fangrui Song's avatar
      [ELF] Respect output section alignment for AT> (non-null lmaRegion) · e21b9ca7
      Fangrui Song authored
      When lmaRegion is non-null, respect `sec->alignment`
      This rule is analogous to `switchTo(sec)` which advances sh_addr (VMA).
      
      This fixes the p_paddr misalignment issue as reported by
      https://android-review.googlesource.com/c/trusty/external/trusted-firmware-a/+/1230058
      
      Note, `sec->alignment` is the maximum of ALIGN and input section alignments. We may overalign LMA than GNU ld.
      
      linkerscript/align-lma.s has a FIXME that demonstrates another bug:
      `.bss ... >RAM` should be placed in a different PT_LOAD (GNU ld
      behavior) because its lmaRegion (nullptr) is different from the previous
      section's lmaRegion (ROM).
      
      Reviewed By: psmith
      
      Differential Revision: https://reviews.llvm.org/D74286
      e21b9ca7
    • Jordan Rupprecht's avatar
      [llvm-objdump] Print file format in lowercase to match GNU output. · 60a8a504
      Jordan Rupprecht authored
      Summary:
      GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. llvm-objdump prints `ELF64-x86-64` right now, even though piping that into llvm-objcopy refuses that as a valid arch to use.
      
      As an example of a problem this causes, see: https://github.com/ClangBuiltLinux/linux/issues/779
      
      Reviewers: MaskRay, jhenderson, alexshap
      
      Reviewed By: MaskRay
      
      Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D74433
      60a8a504
    • Simon Pilgrim's avatar
      [X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression · ff307c81
      Simon Pilgrim authored
      This has a really interesting side effect in that it improves some UMAX/UMIN reduction code which had redundant XOR(SHUFFLE(XOR(X,SIGNMASK)),SIGNMASK) patterns - the getNegatibleCost recognises it as FNEG(SHUFFLE(FNEG(X))).... We have a lot of FNEG patterns bitcasted to the integer domain for XOR signbit twiddling which is similar to what we do to allow UMAX/UMIN to be lowered using SMAX/SMIN.
      
      Differential Revision: https://reviews.llvm.org/D74231
      ff307c81
  2. Feb 12, 2020