Skip to content
  1. Mar 28, 2018
    • David Blaikie's avatar
      Transforms: Introduce Transforms/Utils.h rather than spreading the... · a373d18e
      David Blaikie authored
      Transforms: Introduce Transforms/Utils.h rather than spreading the declarations amongst Scalar.h and IPO.h
      
      Fixes layering - Transforms/Utils shouldn't depend on including a Scalar
      or IPO header, because Scalar and IPO depend on Utils.
      
      llvm-svn: 328717
      a373d18e
    • Alexander Potapenko's avatar
      [MSan] Introduce ActualFnStart. NFC · 4e7ad080
      Alexander Potapenko authored
      This is a step towards the upcoming KMSAN implementation patch.
      KMSAN is going to prepend a special basic block containing
      tool-specific calls to each function. Because we still want to
      instrument the original entry block, we'll need to store it in
      ActualFnStart.
      
      For MSan this will still be F.getEntryBlock(), whereas for KMSAN
      it'll contain the second BB.
      
      llvm-svn: 328697
      4e7ad080
    • Alexander Potapenko's avatar
      [MSan] Add an isStore argument to getShadowOriginPtr(). NFC · e1d58778
      Alexander Potapenko authored
      This is a step towards the upcoming KMSAN implementation patch.
      The isStore argument is to be used by getShadowOriginPtrKernel(),
      it is ignored by getShadowOriginPtrUserspace().
      
      Depending on whether a memory access is a load or a store, KMSAN
      instruments it with different functions, __msan_metadata_ptr_for_load_X()
      and __msan_metadata_ptr_for_store_X().
      
      Those functions may return different values for a single address,
      which is necessary in the case the runtime library decides to ignore
      particular accesses.
      
      llvm-svn: 328692
      e1d58778
  2. Mar 27, 2018
  3. Mar 26, 2018
    • Sanjay Patel's avatar
      [InstCombine] improve code comment; NFC · 0e3167cb
      Sanjay Patel authored
      llvm-svn: 328560
      0e3167cb
    • Sebastian Pop's avatar
      [InstCombine] reassociate loop invariant GEP chains to enable LICM · d870aea0
      Sebastian Pop authored
      This change brings performance of zlib up by 10%. The example below is from a
      hot loop in longest_match() from zlib.
      
      do.body:
        %cur_match.addr.0 = phi i32 [ %cur_match, %entry ], [ %2, %do.cond ]
        %idx.ext = zext i32 %cur_match.addr.0 to i64
        %add.ptr = getelementptr inbounds i8, i8* %win, i64 %idx.ext
        %add.ptr2 = getelementptr inbounds i8, i8* %add.ptr, i64 %idx.ext1
        %add.ptr3 = getelementptr inbounds i8, i8* %add.ptr2, i64 -1
      
      In this example %idx.ext1 is a loop invariant. It will be moved above the use of
      loop induction variable %idx.ext such that it can be hoisted out of the loop by
      LICM. The operands that have dependences carried by the loop will be sinked down
      in the GEP chain. This patch will produce the following output:
      
      do.body:
        %cur_match.addr.0 = phi i32 [ %cur_match, %entry ], [ %2, %do.cond ]
        %idx.ext = zext i32 %cur_match.addr.0 to i64
        %add.ptr = getelementptr inbounds i8, i8* %win, i64 %idx.ext1
        %add.ptr2 = getelementptr inbounds i8, i8* %add.ptr, i64 -1
        %add.ptr3 = getelementptr inbounds i8, i8* %add.ptr2, i64 %idx.ext
      
      llvm-svn: 328539
      d870aea0
    • Sanjay Patel's avatar
      [InstCombine] distribute fmul over fadd/fsub · 4fd4fd61
      Sanjay Patel authored
      This replaces a large chunk of code that was looking for compound
      patterns that include these sub-patterns. Existing tests ensure that
      all of the previous examples are still folded as expected.
      
      We still need to loosen the FMF check.
      
      llvm-svn: 328502
      4fd4fd61
    • Sanjay Patel's avatar
      [InstCombine] check uses before creating instructions for fmul distribution · 2455fef4
      Sanjay Patel authored
      As the tests show, we could create extra instructions without any obvious benefit.
      
      llvm-svn: 328498
      2455fef4
    • Krzysztof Parzyszek's avatar
      [LSR] Allow giving priority to post-incrementing addressing modes · 0b377e0a
      Krzysztof Parzyszek authored
      Implement TTI interface for targets to indicate that the LSR should give
      priority to post-incrementing addressing modes.
      
      Combination of patches by Sebastian Pop and Brendon Cahoon.
      
      Differential Revision: https://reviews.llvm.org/D44758
      
      llvm-svn: 328490
      0b377e0a
    • Max Kazantsev's avatar
      [LoopUnroll] Fix dangling pointers in SCEV · a5574931
      Max Kazantsev authored
      Current logic of loop SCEV invalidation in Loop Unroller implicitly relies on
      fact that exit count of outer loops cannot rely on exiting blocks of
      inner loops, which is true in current implementation of backedge taken count
      calculation but is wrong in general. As result, when we only forget the loop that
      we have just unrolled, we may still have cached data for its outer loops (in particular,
      exit counts) which keeps references on blocks of inner loop that could have been
      changed or even deleted.
      
      The attached test demonstrates a situaton when after unrolling of innermost loop
      the outermost loop contains a dangling pointer on non-existant block. The problem
      shows up when we apply patch https://reviews.llvm.org/D44677 that makes SCEV
      smarter about exit count calculation. I am not sure if the bug exists without this patch,
      it appears that now it is accidentally correct just because in practice exact backedge
      taken count for outer loops with complex control flow inside is never calculated.
      But when SCEV learns to do so, this problem shows up.
      
      This patch replaces existing logic of SCEV loop invalidation with a correct one, which
      happens to be invalidation of outermost loop (which also leads to invalidation of all
      loops inside of it). It is the only way to ensure that no outer loop keeps dangling pointers
      on removed blocks, or just outdated information that has changed after unrolling.
      
      Differential Revision: https://reviews.llvm.org/D44818
      Reviewed By: samparker
      
      llvm-svn: 328483
      a5574931
    • Benjamin Kramer's avatar
      [DeadArgElim] Strip allocsize attributes when deleting an argument. · 8840f644
      Benjamin Kramer authored
      Since allocsize refers to the argument number it gets invalidated when
      an argument is removed and the numbers shift.
      
      llvm-svn: 328481
      8840f644
    • Sam Parker's avatar
      [IRCE] Enable increasing loops of variable bounds · 53a423a4
      Sam Parker authored
          
      CanBeMin is currently used which will report true for any unknown
      values, but often a check is performed outside the loop which covers
      this situation:
          
      for (int i = 0; i < N; ++i)
        ...
          
      if (N > 0)
        for (int i = 0; i < N; ++i)
          ...
          
      So I've add 'LoopGuardedAgainstMin' which reports whether N is
      greater than the minimum value which then allows loop with a variable
      loop count to be optimised. I've also moved the increasing bound
      checking into its own function and replaced SumCanReachMax is another
      isLoopEntryGuardedByCond function.
      
      llvm-svn: 328480
      53a423a4
  4. Mar 25, 2018
  5. Mar 24, 2018
  6. Mar 23, 2018
    • David Blaikie's avatar
    • Fedor Sergeev's avatar
      [PM][FunctionAttrs] add NoUnwind attribute inference to PostOrderFunctionAttrs pass · 6660fd0f
      Fedor Sergeev authored
      Summary:
      This was motivated by absence of PrunEH functionality in new PM.
      It was decided that a proper way to do PruneEH is to add NoUnwind inference
      into PostOrderFunctionAttrs and then perform normal SimplifyCFG on top.
      
      This change generalizes attribute handling implemented for (a removal of)
      Convergent attribute, by introducing a generic builder-like class
         AttributeInferer
      
      It registers all the attribute inference requests, storing per-attribute
      predicates into a vector, and then goes through an SCC Node, scanning all
      the instructions for not breaking attribute assumptions.
      
      The main idea is that as soon all the instructions from all the functions
      of SCC Node conform to attribute assumptions then we are free to infer
      the attribute as set for all the functions of SCC Node.
      
      It handles two distinct cases of attributes:
         - those that might break due to derefinement of the function code
      
           for these attributes we are allowed to apply inference only if all the
           functions are "exact definitions". Example - NoUnwind.
      
         - those that do not care about derefinement
      
           for these attributes we are allowed to apply inference as soon as we see
           any function definition. Example - removal of Convergent attribute.
      
      Also in this commit:
      * Converted all the FunctionAttrs tests to use FileCheck and added new-PM
        invocations to them
      
      * FunctionAttrs/convergent.ll test demonstrates a difference in behavior between
         new and old PM implementations. Marked with FIXME.
      
      * PruneEH tests were converted to new-PM as well, using function-attrs+simplify-cfg
        combo as intended
      
      * some of "other" tests were updated since function-attrs now infers 'nounwind'
        even for old PM pipeline
      
      * -disable-nounwind-inference hidden option added as a possible workaround for a supposedly
        rare case when nounwind being inferred by default presents a problem
      
      Reviewers: chandlerc, jlebar
      
      Reviewed By: jlebar
      
      Subscribers: eraman, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D44415
      
      llvm-svn: 328377
      6660fd0f
    • Sanjay Patel's avatar
      [InstCombine] simplify code for FP intrinsic shrinking; NFCI · 32381d7c
      Sanjay Patel authored
      llvm-svn: 328372
      32381d7c
    • Alex Shlyapnikov's avatar
      [HWASan] Port HWASan to Linux x86-64 (LLVM) · 83e78414
      Alex Shlyapnikov authored
      Summary:
      Porting HWASan to Linux x86-64, first of the three patches, LLVM part.
      
      The approach is similar to ARM case, trap signal is used to communicate
      memory tag check failure. int3 instruction is used to generate a signal,
      access parameters are stored in nop [eax + offset] instruction immediately
      following the int3 one.
      
      One notable difference is that x86-64 has to untag the pointer before use
      due to the lack of feature comparable to ARM's TBI (Top Byte Ignore).
      
      Reviewers: eugenis
      
      Subscribers: kristof.beyls, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D44699
      
      llvm-svn: 328342
      83e78414
    • Andrew Kaylor's avatar
      Fix a block copying problem in LICM · a237866f
      Andrew Kaylor authored
      Differential Revision: https://reviews.llvm.org/D44817
      
      llvm-svn: 328336
      a237866f
    • Sanjay Patel's avatar
      [InstCombine] reduce code duplication; NFC · 713ca3d3
      Sanjay Patel authored
      llvm-svn: 328323
      713ca3d3
    • Sanjay Patel's avatar
      [InstCombine] improve variable name; NFC · 6de89ce3
      Sanjay Patel authored
      llvm-svn: 328322
      6de89ce3
    • Matthew Simpson's avatar
      [SLP] Stop counting cost of gather sequences with multiple uses · 6c289a1c
      Matthew Simpson authored
      When building the SLP tree, we look for reuse among the vectorized tree
      entries. However, each gather sequence is represented by a unique tree entry,
      even though the sequence may be identical to another one. This means, for
      example, that a gather sequence with two uses will be counted twice when
      computing the cost of the tree. We should only count the cost of the definition
      of a gather sequence rather than its uses. During code generation, the
      redundant gather sequences are emitted, but we optimize them away with CSE. So
      it looks like this problem just affects the cost model.
      
      Differential Revision: https://reviews.llvm.org/D44742
      
      llvm-svn: 328316
      6c289a1c
    • Florian Hahn's avatar
      Revert r328307: [IPSCCP] Use constant range information for comparisons of parameters. · f73c3ece
      Florian Hahn authored
      Reverted for now, due to it causing verifier failures.
      
      llvm-svn: 328312
      f73c3ece
    • Florian Hahn's avatar
      [IPSCCP] Use constant range information for comparisons of parameters. · b1feec08
      Florian Hahn authored
      For comparisons with parameters, we can use the ParamState lattice
      elements which also provide constant range information. This improves
      the code for PR33253 further and gets us closer to use
      ValueLatticeElement for all values.
      
      Also, as we are using the range information in the solver directly, we
      do not need tryToReplaceWithConstantRange afterwards anymore.
      
      Reviewers: dberlin, mssimpso, davide, efriedma
      
      Reviewed By: mssimpso
      
      Differential Revision: https://reviews.llvm.org/D43762
      
      llvm-svn: 328307
      b1feec08
    • Florian Hahn's avatar
      [LoopUnroll] Simplify induction variables after peeling too. · 52436a58
      Florian Hahn authored
      Loop peeling also has an impact on the induction variables, so we should
      benefit from induction variable simplification after peeling too.
      
      Reviewers: sanjoy, bogner, mzolotukhin, efriedma
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D43878
      
      llvm-svn: 328301
      52436a58
  7. Mar 22, 2018
Loading