Skip to content
  1. May 14, 2018
  2. May 13, 2018
  3. May 12, 2018
    • Michael Zolotukhin's avatar
      Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." · a41660df
      Michael Zolotukhin authored
      Stage3/stage4 bootstrap miscompares should be fixed by a non-determinism
      fix in IDF (r332167).
      
      This reverts commit r330446.
      
      llvm-svn: 332168
      a41660df
    • Sergey Dmitriev's avatar
      [CodeExtractor] Allow extracting blocks with exception handling · 69c9cd27
      Sergey Dmitriev authored
      This is a CodeExtractor improvement which adds support for extracting blocks
      which have exception handling constructs if that is legal to do. CodeExtractor
      performs validation checks to ensure that extraction is legal when it finds
      invoke instructions or EH pads (landingpad, catchswitch, or cleanuppad) in
      blocks to be extracted.
      
      I have also added an option to allow extraction of blocks with alloca
      instructions, but no validation is done for allocas. CodeExtractor caller has
      to validate it himself before allowing alloca instructions to be extracted.
      By default allocas are still not allowed in extraction blocks.
      
      Differential Revision: https://reviews.llvm.org/D45904
      
      llvm-svn: 332151
      69c9cd27
  4. May 11, 2018
    • Craig Topper's avatar
    • Artem Belevich's avatar
      [Split GEP] handle trunc() in separate-const-offset-from-gep pass. · c2cd5d5c
      Artem Belevich authored
      Let separate-const-offset-from-gep pass handle trunc() when it calculates
      constant offset relative to base. The pass itself may insert trunc()
      instructions when it canonicalises array indices to pointer-size integers
      and needs to handle trunc() in order to evaluate the offset.
      
      Differential Revision: https://reviews.llvm.org/D46732
      
      llvm-svn: 332142
      c2cd5d5c
    • Daniel Neilson's avatar
      [InstCombine] Handle atomic memset in the same way as regular memset · f6651d4d
      Daniel Neilson authored
      Summary:
      This change adds handling of the atomic memset intrinsic to the
      code path that simplifies the regular memset. In practice this means
      that we will now also expand a small constant-length atomic memset
      into a single unordered atomic store.
      
      Reviewers: apilipenko, skatkov, mkazantsev, anna, reames
      
      Reviewed By: reames
      
      Subscribers: reames, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46660
      
      llvm-svn: 332132
      f6651d4d
    • David Bolvansky's avatar
      [InstCombine] snprintf optimizations · cd93c4ef
      David Bolvansky authored
      Reviewers: spatel, efriedma, majnemer, rja, bkramer
      
      Reviewed By: rja, bkramer
      
      Subscribers: mstorsjo, rja, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46285
      
      llvm-svn: 332110
      cd93c4ef
    • Davide Italiano's avatar
      [Reassociate] Prevent infinite loops when processing PHIs. · 6e1f7bf3
      Davide Italiano authored
      Phi nodes can reside in live blocks but one of their incoming
      arguments can come from a dead block. Dead blocks and reassociate
      don't play nice together. In fact, reassociate performs an RPO
      as a first step to avoid processing dead blocks.
      
      The reason why Reassociate might not fixpoint when examining
      dead blocks is that the following:
      
        %xor0 = xor i16 %xor1, undef
        %xor1 = xor i16 %xor0, undef
      
      is perfectly valid LLVM IR (if it appears in a dead block),
      so the worklist algorithm keeps pushing the two instructions for
      reexamination. Note that this is not Reassociate fault, at least
      not entirely. It's llvm that has a weird definition of dominance.
      
      Fixes PR37390.
      
      llvm-svn: 332100
      6e1f7bf3
    • Daniel Neilson's avatar
      [InstCombine] Unify handling of atomic memtransfer with non-atomic memtransfer · 8f30ec65
      Daniel Neilson authored
      Summary:
      This change reworks the handling of atomic memcpy within the instcombine pass.
      Previously, a constant length atomic memcpy would be lowered into loads & stores
      as long as no more than 16 load/store pairs are created. This is quite different
      from the lowering done for a non-atomic memcpy; which only ever lowers into a single
      load/store pair of no more than 8 bytes. Larger constant-sized memcpy calls are
      expanded to load/stores in later passes, such as SelectionDAG lowering.
      
      In this change the behaviour for atomic memcpy is unified with non-atomic memcpy;
      atomic memcpy is now treated in the same was as non-atomic memcpy has always been.
      We leave it to later passes to lower longer-length atomic memcpy calls.
      
      Due to the structure of the pass's handling of memtransfer intrinsics, this change
      also gives us handling of atomic memmove that we did not previously have.
      
      Reviewers: apilipenko, skatkov, mkazantsev, anna, reames
      
      Reviewed By: reames
      
      Subscribers: reames, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46658
      
      llvm-svn: 332093
      8f30ec65
    • Brian Gesiak's avatar
      [Coroutines] PR34897: Fix incorrect elisions · c6511134
      Brian Gesiak authored
      Summary:
      https://bugs.llvm.org/show_bug.cgi?id=34897 demonstrates an incorrect
      coroutine frame allocation elision in the coro-elide pass. The elision
      is performed on the basis that the SSA variables from all llvm.coro.begin
      are directly referenced in subsequent llvm.coro.destroy instructions.
      
      However, this ignores the fact that the function may exit through paths
      that do not run these destroy instructions. In the sample program from
      PR34897, for example, the llvm.coro.destroy instruction is only
      executed in exception handling code. When the coroutine function exits
      normally, llvm.coro.destroy is not called. Eliding the allocation in
      this case causes a subsequent reference to the coroutine handle from
      outside of the function to access freed memory.
      
      To fix the issue, when finding an llvm.coro.destroy for each llvm.coro.begin,
      only consider llvm.coro.destroy that are executed along non-exceptional paths.
      
      Test Plan:
      1. Download the sample program from
         https://bugs.llvm.org/show_bug.cgi?id=34897, compile it with
         `clang++ -fcoroutines-ts -stdlib=libc++ -std=c++1z -O2`, and run it.
         It should print `"run1\ncheck1\nrun2\ncheck2"` and then exit
         successfully.
      2. Compile https://godbolt.org/g/mCKfnr and confirm it is still
         optimized to a single instruction, 'return 1190'.
      3. `check-llvm`
      
      Reviewers: rsmith, GorNishanov, eric_niebler
      
      Reviewed By: GorNishanov
      
      Subscribers: andrewrk, lewissbaker, EricWF, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D43242
      
      llvm-svn: 332077
      c6511134
    • Kostya Serebryany's avatar
    • Kamil Rytarowski's avatar
      Register NetBSD/i386 in AddressSanitizer.cpp · 02c432a7
      Kamil Rytarowski authored
      Summary:
      Ship kNetBSD_ShadowOffset32 set to 1ULL << 30.
      
      This is prepared for the amd64 kernel runtime.
      
      Sponsored by <The NetBSD Foundation>
      
      Reviewers: vitalybuka, joerg, kcc
      
      Reviewed By: vitalybuka
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46724
      
      llvm-svn: 332069
      02c432a7
    • Wei Mi's avatar
      [SampleFDO] Don't treat warm callsite with inline instance in the profile as cold · 0c2f6be6
      Wei Mi authored
      We found current sampleFDO had a performance issue when triaging a regression.
      For a callsite with inline instance in the profile, even if hot callsite inliner
      cannot inline it, it may still execute enough times and should not be treated as
      cold in regular inliner later. However, currently if such callsite is not inlined
      by hot callsite inliner, and the BB where the callsite locates doesn't get
      samples from other instructions inside of it, the callsite will have no profile
      metadata annotated. In regular inliner cost analysis, if the callsite has no
      profile annotated and its caller has profile information, it will be treated as
      cold.
      
      The fix changes the isCallsiteHot check and chooses to compare
      CallsiteTotalSamples with hot cutoff value computed by ProfileSummaryInfo.
      
      Differential Revision: https://reviews.llvm.org/D45377
      
      llvm-svn: 332058
      0c2f6be6
    • Vedant Kumar's avatar
      [STLExtras] Add distance() for ranges, pred_size(), and succ_size() · e0b5f86b
      Vedant Kumar authored
      This commit adds a wrapper for std::distance() which works with ranges.
      As it would be a common case to write `distance(predecessors(BB))`, this
      also introduces `pred_size()` and `succ_size()` helpers to make that
      easier to write.
      
      Differential Revision: https://reviews.llvm.org/D46668
      
      llvm-svn: 332057
      e0b5f86b
    • Craig Topper's avatar
      [InstCombine] Replace an 'if' that should always be true with an assert. · ea78a261
      Craig Topper authored
      The bitwidth of the operation should always be wider than the result width of the truncate since we don't recurse through any width changing operations.
      
      llvm-svn: 332055
      ea78a261
  5. May 10, 2018
  6. May 09, 2018
    • David Bolvansky's avatar
      [InstCombine] snprintf optimizations · 9b5e6e82
      David Bolvansky authored
      Reviewers: spatel, efriedma, majnemer, rja, bkramer
      
      Reviewed By: rja, bkramer
      
      Subscribers: rja, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46285
      
      llvm-svn: 331889
      9b5e6e82
    • Krzysztof Parzyszek's avatar
      [LV] Change MaxVectorSize bound to 256 in assertion, NFC otherwise · ea4c1bb7
      Krzysztof Parzyszek authored
      It's possible to have a vector of 256 bytes in HVX code on Hexagon
      (vector pair in 128-byte mode).
      
      llvm-svn: 331885
      ea4c1bb7
    • Benjamin Kramer's avatar
      Revert "[InstCombine] snprintf optimizations" · ccb0fbe9
      Benjamin Kramer authored
      This reverts commit r331849. It miscompiles
      snprintf(buf, sizeof(buf), "%s", "any constant string); into
      memcpy(buf, "%s", sizeof("any constant string"));
      
      llvm-svn: 331866
      ccb0fbe9
    • Bjorn Pettersson's avatar
      [MergedLoadStoreMotion] Fix a debug invariant bug in mergeStores · 9f953cdd
      Bjorn Pettersson authored
      Summary:
      MergedLoadStoreMotion::mergeStores is using some heuristics
      to limit the amount of stores that it tries to sink (see
      MagicCompileTimeControl in MergedLoadStoreMotion.cpp). The
      heuristic involves counting the number of instructions in
      one of the basic blocks that is part of the transformation.
      
      We now ignore dbg intrinsics when counting instruction for
      the MagicCompileTimeControl heuristic. This to make sure that
      the amount of stores that are sunk doesn't depend on the amount
      of debug information (if -g is used or not).
      
      Reviewers: Gerolf, davide, majnemer
      
      Reviewed By: davide
      
      Subscribers: dberlin, bjope, aprantl, JDevlieghere, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46600
      
      llvm-svn: 331852
      9f953cdd
    • David Bolvansky's avatar
      [InstCombine] snprintf optimizations · 44a37f04
      David Bolvansky authored
      Reviewers: spatel, efriedma, majnemer, rja
      
      Reviewed By: rja
      
      Subscribers: rja, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46285
      
      llvm-svn: 331849
      44a37f04
    • Shiva Chen's avatar
      [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. · 2c864551
      Shiva Chen authored
      In order to set breakpoints on labels and list source code around
      labels, we need collect debug information for labels, i.e., label
      name, the function label belong, line number in the file, and the
      address label located. In order to keep these information in LLVM
      IR and to allow backend to generate debug information correctly.
      We create a new kind of metadata for labels, DILabel. The format
      of DILabel is
      
      !DILabel(scope: !1, name: "foo", file: !2, line: 3)
      
      We hope to keep debug information as much as possible even the
      code is optimized. So, we create a new kind of intrinsic for label
      metadata to avoid the metadata is eliminated with basic block.
      The intrinsic will keep existing if we keep it from optimized out.
      The format of the intrinsic is
      
      llvm.dbg.label(metadata !1)
      
      It has only one argument, that is the DILabel metadata. The
      intrinsic will follow the label immediately. Backend could get the
      label metadata through the intrinsic's parameter.
      
      We also create DIBuilder API for labels to be used by Frontend.
      Frontend could use createLabel() to allocate DILabel objects, and use
      insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
      
      Differential Revision: https://reviews.llvm.org/D45024
      
      Patch by Hsiangkai Wang.
      
      llvm-svn: 331841
      2c864551
    • Heejin Ahn's avatar
      Support a funclet operand bundle in LowerInvoke · bf771695
      Heejin Ahn authored
      Summary:
      The current LowerInvoke pass cannot handle invoke instructions with a
      funclet bundle operand. The order of operands for an invoke instruction
      is {call arguments, callee, funclet operand (if any), normal dest,
      unwind dest}. The current code assumes there is no funclet operand and
      incorrectly includes a funclet operand into call arguments.
      
      Reviewers: rnk
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D46242
      
      llvm-svn: 331832
      bf771695
Loading