1. Aug 11, 2019
  2. Aug 10, 2019
    • Sanjay Patel's avatar
      [Reassociate] try harder to convert negative FP constants to positive · 21c15ef3
      Sanjay Patel authored
      This is an extension of a transform that tries to produce positive floating-point
      constants to improve canonicalization (and hopefully lead to more reassociation
      and CSE).
      
      The original patches were:
      D4904
      D5363 (rL221721)
      
      But as the test diffs show, these were limited to basic patterns by walking from
      an instruction to its single user rather than recursively moving up the def-use
      sequence. No fast-math is required here because we're only rearranging implicit
      FP negations in intermediate ops.
      
      A motivating bug is:
      https://bugs.llvm.org/show_bug.cgi?id=32939
      
      Differential Revision: https://reviews.llvm.org/D65954
      
      llvm-svn: 368512
      21c15ef3
    • Raphael Isemann's avatar
      [lldb] Fix dynamic_cast by no longer failing on variable without metadata · b448d1bf
      Raphael Isemann authored
      Summary:
      Our IR rewriting infrastructure currently fails when it encounters a variable which has no metadata associated.
      This causes dynamic_cast to fail as in this case IRForTarget considers the type info pointers ('@_ZTI...') to be
      variables without associated metadata. As there are no variables for these internal variables, this is actually
      not an error and dynamic_cast would work fine if we didn't throw this error.
      
      This patch fixes this by removing this diagnostics code. In case we would actually hit a variable that has no
      metadata (but is supposed to have), we still have the error in the expression log so this shouldn't make it
      harder to diagnose any missing metadata errors.
      
      This patch should fix dynamic_cast and also adds a bunch of test coverage to that language feature.
      
      Fixes rdar://10813639
      
      Reviewers: davide, labath
      
      Reviewed By: labath
      
      Subscribers: friss, labath, abidh, lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D65932
      
      llvm-svn: 368511
      b448d1bf
    • Raphael Isemann's avatar
      [clang] Fixed x86 cpuid NSC signature · c4b5b66a
      Raphael Isemann authored
      Summary:
      The signature "Geode by NSC" for NSC vendor is wrong.
      In lib/Headers/cpuid.h, signature_NSC_edx and signature_NSC_ecx constants are inverted (cpuid signature order is ebx # edx # ecx).
      
      Reviewers: teemperor, rsmith, craig.topper
      
      Reviewed By: teemperor, craig.topper
      
      Subscribers: craig.topper, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D65978
      
      llvm-svn: 368510
      c4b5b66a
    • Kang Zhang's avatar
      [CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks · 36cd84bd
      Kang Zhang authored
      Summary:
      
      In `block-placement` pass, it will create some patterns for unconditional we can do the simple early retrun.
      But the `early-ret` pass is before `block-placement`, we don't want to run it again.
      This patch is to do the simple early return to optimize the blocks at the last of `block-placement`.
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D63972
      
      llvm-svn: 368509
      36cd84bd
    • Kristina Brooks's avatar
      [modulemap] Add AArch64SVEACLETypes.def · 3ab587df
      Kristina Brooks authored
      Update modulemap with a new textual header.
      
      llvm-svn: 368508
      3ab587df
    • Owen Pan's avatar
      [clang-format] Add SpaceInEmptyBlock option for WebKit · db4ad360
      Owen Pan authored
      See PR40840
      
      Differential Revision: https://reviews.llvm.org/D65925
      
      llvm-svn: 368507
      db4ad360
    • Craig Topper's avatar
      [X86] Match the IR pattern form movmsk on SSE1 only targets where v4i32 isn't legal · 74c43a22
      Craig Topper authored
      Summary:
      This patch adds a special DAG combine for SSE1 to recognize the IR pattern InstCombine gives us for movmsk. This only does the recognition for a few cases where its obvious the input won't be scalarized resulting in building a vector just do to the movmsk. I've made it separate from our existing matching for movmsk since that's called in multiple places and I didn't spend time to see if the other callers would make sense here. Plus the restrictions and additional checks would complicate that.
      
      This fixes the case from PR42870. Buts its probably still broken the presence of logic ops feeding the movmsk pattern which would further hide the v4f32 type.
      
      Reviewers: spatel, RKSimon, xbolva00
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65689
      
      llvm-svn: 368506
      74c43a22
    • Craig Topper's avatar
      [X86] Improve the diagnostic for larger than 4-bit immediate for... · a8e5e737
      Craig Topper authored
      [X86] Improve the diagnostic for larger than 4-bit immediate for vpermil2pd/ps. Only allow MCConstantExprs.
      
      llvm-svn: 368505
      a8e5e737
    • David Carlier's avatar
      [Sanitizer] Reenable getusershell interception · 8d1646bf
      David Carlier authored
      and disabling it forAndroid.
      
      Reviewers: krytarowski, vitalybuka
      
      Reviewed By: krytarowski
      
      Differential Revision: https://reviews.llvm.org/D66027
      
      llvm-svn: 368504
      8d1646bf
    • Luo, Yuanke's avatar
      [X86] Fix stack probe issue on windows32. · c6c86f4f
      Luo, Yuanke authored
      Summary:
      On windows if the frame size exceed 4096 bytes, compiler need to
      generate a call to _alloca_probe. X86CallFrameOptimization pass
      changes the reserved stack size and cause of stack probe function
      not be inserted. This patch fix the issue by detecting the call
      frame size, if the size exceed 4096 bytes, drop X86CallFrameOptimization.
      
      Reviewers: craig.topper, wxiao3, annita.zhang, rnk, RKSimon
      
      Reviewed By: rnk
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D65923
      
      llvm-svn: 368503
      c6c86f4f
    • Fedor Sergeev's avatar
      [MemDep] allow to select block-scan-limit when constructing MemoryDependenceAnalysis · 92e160ab
      Fedor Sergeev authored
      Introducing non-global control for default block-scan-limit in MemDep analysis.
      Useful when there are many compilations per initialized LLVM instance (e.g. JIT).
      
      Reviewed By: asbirlea
      Tags: #llvm
      Differential Revision: https://reviews.llvm.org/D65806
      
      llvm-svn: 368502
      92e160ab
    • Gabor Horvath's avatar
      eb563af7
    • Sam McCall's avatar
      [clangd] Disallow extraction of expression-statements. · 1aaef90c
      Sam McCall authored
      Summary:
      I split out the "extract parent instead of this" logic from the "this isn't
      worth extracting" logic (now in eligibleForExtraction()), because I found it
      hard to reason about.
      
      While here, handle overloaded as well as builtin assignment operators.
      
      Also this uncovered a bug in getCallExpr() which I fixed.
      
      Reviewers: SureYeaah
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D65337
      
      llvm-svn: 368500
      1aaef90c
    • Gabor Horvath's avatar
    • Sam McCall's avatar
      clangd: use -j for background index pool · 4bd6ebb4
      Sam McCall authored
      Summary:
      clangd supports a -j option to limit the amount of threads to use for parsing
      TUs. However, when using -background-index (the default in later versions of
      clangd), the parallelism used by clangd defaults to the hardware_parallelisn,
      i.e. number of physical cores.
      
      On shared hardware environments, with large projects, this can significantly
      affect performance with no way to tune it down.
      
      This change makes the -j parameter apply equally to parsing and background
      index. It's not perfect, because the total number of threads is 2x the -j value,
      which may still be unexpected. But at least this change allows users to prevent
      clangd using all CPU cores.
      
      Reviewers: kadircet, sammccall
      
      Reviewed By: sammccall
      
      Subscribers: javed.absar, jfb, sammccall, ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D66031
      
      llvm-svn: 368498
      4bd6ebb4
    • Haibo Huang's avatar
      Small format fix · 575ce5da
      Haibo Huang authored
      Differential Revision: https://reviews.llvm.org/D66034
      
      llvm-svn: 368497
      575ce5da
    • Haibo Huang's avatar
      Detects whether RESOURCE_TYPE_IO is defined. · a20a59d8
      Haibo Huang authored
      Summary: This fixes lldb build on macOS SDK prior to 10.12.
      
      Reviewers: JDevlieghere
      
      Subscribers: lldb-commits
      
      Tags: #lldb
      
      Differential Revision: https://reviews.llvm.org/D66034
      
      llvm-svn: 368496
      a20a59d8
    • Peter Collingbourne's avatar
      cfi-icall: Allow the jump table to be optionally made non-canonical. · 0e497d15
      Peter Collingbourne authored
      The default behavior of Clang's indirect function call checker will replace
      the address of each CFI-checked function in the output file's symbol table
      with the address of a jump table entry which will pass CFI checks. We refer
      to this as making the jump table `canonical`. This property allows code that
      was not compiled with ``-fsanitize=cfi-icall`` to take a CFI-valid address
      of a function, but it comes with a couple of caveats that are especially
      relevant for users of cross-DSO CFI:
      
      - There is a performance and code size overhead associated with each
        exported function, because each such function must have an associated
        jump table entry, which must be emitted even in the common case where the
        function is never address-taken anywhere in the program, and must be used
        even for direct calls between DSOs, in addition to the PLT overhead.
      
      - There is no good way to take a CFI-valid address of a function written in
        assembly or a language not supported by Clang. The reason is that the code
        generator would need to insert a jump table in order to form a CFI-valid
        address for assembly functions, but there is no way in general for the
        code generator to determine the language of the function. This may be
        possible with LTO in the intra-DSO case, but in the cross-DSO case the only
        information available is the function declaration. One possible solution
        is to add a C wrapper for each assembly function, but these wrappers can
        present a significant maintenance burden for heavy users of assembly in
        addition to adding runtime overhead.
      
      For these reasons, we provide the option of making the jump table non-canonical
      with the flag ``-fno-sanitize-cfi-canonical-jump-tables``. When the jump
      table is made non-canonical, symbol table entries point directly to the
      function body. Any instances of a function's address being taken in C will
      be replaced with a jump table address.
      
      This scheme does have its own caveats, however. It does end up breaking
      function address equality more aggressively than the default behavior,
      especially in cross-DSO mode which normally preserves function address
      equality entirely.
      
      Furthermore, it is occasionally necessary for code not compiled with
      ``-fsanitize=cfi-icall`` to take a function address that is valid
      for CFI. For example, this is necessary when a function's address
      is taken by assembly code and then called by CFI-checking C code. The
      ``__attribute__((cfi_jump_table_canonical))`` attribute may be used to make
      the jump table entry of a specific function canonical so that the external
      code will end up taking a address for the function that will pass CFI checks.
      
      Fixes PR41972.
      
      Differential Revision: https://reviews.llvm.org/D65629
      
      llvm-svn: 368495
      0e497d15
    • Daniel Sanders's avatar
      Add missing REQUIRES to r368487 · 2a190c5d
      Daniel Sanders authored
      llvm-svn: 368494
      2a190c5d
    • Diego Trevino Ferrer's avatar
      [Bugpoint redesign] Fix nonlocal URI link in doc · 72f996e4
      Diego Trevino Ferrer authored
      Summary: Fixes documentation bot build  http://lab.llvm.org:8011/builders/llvm-sphinx-docs
      
      Reviewers: JDevlieghere
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D66022
      
      llvm-svn: 368493
      72f996e4
    • Julian Lettner's avatar
      [Sanitizer][Darwin] Add interceptor for malloc_zone_from_ptr · 5ef4b190
      Julian Lettner authored
      Ensure that malloc_default_zone and malloc_zone_from_ptr return the
      sanitizer-installed malloc zone even when MallocStackLogging (MSL) is
      requested. This prevents crashes in certain situations. Note that the
      sanitizers and MSL cannot be used together. If both are enabled, MSL
      functionality is essentially deactivated since it only hooks the default
      allocator which is replaced by a custom sanitizer allocator.
      
      rdar://53686175
      
      Reviewed By: kubamracek
      
      Differential Revision: https://reviews.llvm.org/D65990
      
      llvm-svn: 368492
      5ef4b190
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP] Add support for close map modifier in Clang · 0fd073b1
      Gheorghe-Teodor Bercea authored
      Summary:
      This patch adds support for the close map modifier in Clang.
      
      This ensures that the new map type is marked and passed to the OpenMP runtime appropriately.
      
      Additional regression tests have been merged from patch D55892 (author @saghir).
      
      Reviewers: ABataev, caomhin, jdoerfert, kkwli0
      
      Reviewed By: ABataev
      
      Subscribers: kkwli0, Hahnfeld, saghir, guansong, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D65341
      
      llvm-svn: 368491
      0fd073b1
    • Sanjay Patel's avatar
      [DAGCombiner] exclude x*2.0 from normal negation profitability rules · 26b2c114
      Sanjay Patel authored
      This is the codegen part of fixing:
      https://bugs.llvm.org/show_bug.cgi?id=32939
      
      Even with the optimal/canonical IR that is ideally created by D65954,
      we would reverse that transform in DAGCombiner and end up with the same
      asm on AArch64 or x86.
      
      I see 2 options for trying to correct this:
      
        1. Limit isNegatibleForFree() by special-casing the fmul pattern (this patch).
        2. Avoid creating (fmul X, 2.0) in the 1st place by adding a special-case
           transform to SelectionDAG::getNode() and/or SelectionDAGBuilder::visitFMul()
           that matches the transform done by DAGCombiner.
      
      This seems like the less intrusive patch, but if there's some other reason to
      prefer 1 option over the other, we can change to the other option.
      
      Differential Revision: https://reviews.llvm.org/D66016
      
      llvm-svn: 368490
      26b2c114
    • Daniel Sanders's avatar
      Remove leftover MF->dump()'s from r368487 that break release builds · 0a317df5
      Daniel Sanders authored
      llvm-svn: 368489
      0a317df5
    • Gheorghe-Teodor Bercea's avatar
      [OpenMP][libomptarget] Add support for close map modifier · 6c7b882e
      Gheorghe-Teodor Bercea authored
      Summary:
      This patch adds support for the close map modifier.
      
      The close map modifier will overwrite the unified shared memory requirement and create a device copy of the data.
      
      Reviewers: ABataev, Hahnfeld, caomhin, grokos, jdoerfert, AlexEichenberger
      
      Reviewed By: Hahnfeld, AlexEichenberger
      
      Subscribers: guansong, openmp-commits
      
      Tags: #openmp
      
      Differential Revision: https://reviews.llvm.org/D65340
      
      llvm-svn: 368488
      6c7b882e
    • Daniel Sanders's avatar
      [globalisel] Add G_SEXT_INREG · e9a57c2b
      Daniel Sanders authored
      Summary:
      Targets often have instructions that can sign-extend certain cases faster
      than the equivalent shift-left/arithmetic-shift-right. Such cases can be
      identified by matching a shift-left/shift-right pair but there are some
      issues with this in the context of combines. For example, suppose you can
      sign-extend 8-bit up to 32-bit with a target extend instruction.
        %1:_(s32) = G_SHL %0:_(s32), i32 24 # (I've inlined the G_CONSTANT for brevity)
        %2:_(s32) = G_ASHR %1:_(s32), i32 24
        %3:_(s32) = G_ASHR %2:_(s32), i32 1
      would reasonably combine to:
        %1:_(s32) = G_SHL %0:_(s32), i32 24
        %2:_(s32) = G_ASHR %1:_(s32), i32 25
      which no longer matches the special case. If your shifts and extend are
      equal cost, this would break even as a pair of shifts but if your shift is
      more expensive than the extend then it's cheaper as:
        %2:_(s32) = G_SEXT_INREG %0:_(s32), i32 8
        %3:_(s32) = G_ASHR %2:_(s32), i32 1
      It's possible to match the shift-pair in ISel and emit an extend and ashr.
      However, this is far from the only way to break this shift pair and make
      it hard to match the extends. Another example is that with the right
      known-zeros, this:
        %1:_(s32) = G_SHL %0:_(s32), i32 24
        %2:_(s32) = G_ASHR %1:_(s32), i32 24
        %3:_(s32) = G_MUL %2:_(s32), i32 2
      can become:
        %1:_(s32) = G_SHL %0:_(s32), i32 24
        %2:_(s32) = G_ASHR %1:_(s32), i32 23
      
      All upstream targets have been configured to lower it to the current
      G_SHL,G_ASHR pair but will likely want to make it legal in some cases to
      handle their faster cases.
      
      To follow-up: Provide a way to legalize based on the constant. At the
      moment, I'm thinking that the best way to achieve this is to provide the
      MI in LegalityQuery but that opens the door to breaking core principles
      of the legalizer (legality is not context sensitive). That said, it's
      worth noting that looking at other instructions and acting on that
      information doesn't violate this principle in itself. It's only a
      violation if, at the end of legalization, a pass that checks legality
      without being able to see the context would say an instruction might not be
      legal. That's a fairly subtle distinction so to give a concrete example,
      saying %2 in:
        %1 = G_CONSTANT 16
        %2 = G_SEXT_INREG %0, %1
      is legal is in violation of that principle if the legality of %2 depends
      on %1 being constant and/or being 16. However, legalizing to either:
        %2 = G_SEXT_INREG %0, 16
      or:
        %1 = G_CONSTANT 16
        %2:_(s32) = G_SHL %0, %1
        %3:_(s32) = G_ASHR %2, %1
      depending on whether %1 is constant and 16 does not violate that principle
      since both outputs are genuinely legal.
      
      Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, arsenm
      
      Subscribers: sdardis, jvesely, wdng, nhaehnle, rovka, kristof.beyls, javed.absar, hiraditya, jrtc27, atanasyan, Petar.Avramovic, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D61289
      
      llvm-svn: 368487
      e9a57c2b
    • Eric Christopher's avatar
      Remove variable only used in an assert. · db2f17d3
      Eric Christopher authored
      llvm-svn: 368486
      db2f17d3
    • Taewook Oh's avatar
      Revert the test commit · 6c99bb2d
      Taewook Oh authored
      llvm-svn: 368485
      6c99bb2d
    • Diego Astiazaran's avatar
      [clang-doc] Generate an HTML index file · dc30049c
      Diego Astiazaran authored
      clang-doc now generates a file that contains only an index to all the
      infos that can be used as the landing page for the generated website.
      
      Differential Revision: https://reviews.llvm.org/D65918
      
      llvm-svn: 368484
      dc30049c
    • Taewook Oh's avatar
      Test commit. · 20ead386
      Taewook Oh authored
      llvm-svn: 368483
      20ead386
    • Sam McCall's avatar
      [clangd] Give absolute path to clang-tidy and include-fixer. HintPath should... · 06431b2b
      Sam McCall authored
      [clangd] Give absolute path to clang-tidy and include-fixer. HintPath should always be absolute, some URI schemes care.
      
      llvm-svn: 368482
      06431b2b
    • Eric Christopher's avatar
      Revert "[sanitizers] MSVC warning disable for clean build" and follow-up that... · 11c18472
      Eric Christopher authored
      Revert "[sanitizers] MSVC warning disable for clean build" and follow-up that tried to fix the build as it's still broken.
      
      This reverts commit 368476 and 368480.
      
      llvm-svn: 368481
      11c18472
    • Martin Storsjo's avatar
      Fix compilation after SVN r368476 · 96a2b25b
      Martin Storsjo authored
      That revision broke compilation with this error:
      
      lib/builtins/fixunsxfdi.c:13:2: error: unterminated conditional directive
       #if !_ARCH_PPC
      
      llvm-svn: 368480
      96a2b25b
    • Craig Topper's avatar
      [X86] Remove custom handling for extloads from LowerLoad. · 6cb05ca0
      Craig Topper authored
      We don't appear to need this with widening legalization.
      
      llvm-svn: 368479
      6cb05ca0