Skip to content
  1. May 21, 2020
    • Yevgeny Rouban's avatar
      [BrachProbablityInfo] Set edge probabilities at once and fix calcMetadataWeights() · 81384874
      Yevgeny Rouban authored
      Hide the method that allows setting probability for particular edge
      and introduce a public method that sets probabilities for all
      outgoing edges at once.
      Setting individual edge probability is error prone. More over it is
      difficult to check that the total probability is 1.0 because there is
      no easy way to know when the user finished setting all
      the probabilities.
      
      Related bug is fixed in BranchProbabilityInfo::calcMetadataWeights().
      Changing unreachable branch probabilities to raw(1) and distributing
      the rest (oldProbability - raw(1)) over the reachable branches could
      introduce total probability inaccuracy bigger than 1/numOfBranches.
      
      Reviewers: yamauchi, ebrevnov
      Tags: #llvm
      Differential Revision: https://reviews.llvm.org/D79396
      81384874
    • Juneyoung Lee's avatar
      Add CanonicalizeFreezeInLoops pass · d9a4a244
      Juneyoung Lee authored
      Summary:
      If an induction variable is frozen and used, SCEV yields imprecise result
      because it doesn't say anything about frozen variables.
      
      Due to this reason, performance degradation happened after
      https://reviews.llvm.org/D76483 is merged, causing
      SCEV yield imprecise result and preventing LSR to optimize a loop.
      
      The suggested solution here is to add a pass which canonicalizes frozen variables
      inside a loop. To be specific, it pushes freezes out of the loop by freezing
      the initial value and step values instead & dropping nsw/nuw flags from instructions used by freeze.
      This solution was also mentioned at https://reviews.llvm.org/D70623 .
      
      Reviewers: spatel, efriedma, lebedev.ri, fhahn, jdoerfert
      
      Reviewed By: fhahn
      
      Subscribers: nikic, mgorny, hiraditya, javed.absar, llvm-commits, sanwou01, nlopes
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77523
      d9a4a244
    • Eli Friedman's avatar
      Make Value::getPointerAlignment() return an Align, not a MaybeAlign. · f26bdb53
      Eli Friedman authored
      If we don't know anything about the alignment of a pointer, Align(1) is
      still correct: all pointers are at least 1-byte aligned.
      
      Included in this patch is a bugfix for an issue discovered during this
      cleanup: pointers with "dereferenceable" attributes/metadata were
      assumed to be aligned according to the type of the pointer.  This
      wasn't intentional, as far as I can tell, so Loads.cpp was fixed to
      stop making this assumption. Frontends may need to be updated.  I
      updated clang's handling of C++ references, and added a release note for
      this.
      
      Differential Revision: https://reviews.llvm.org/D80072
      f26bdb53
  2. May 20, 2020
    • Roman Lebedev's avatar
      [InstCombine] `insertelement` is negatible if both sources are negatible · 55430f53
      Roman Lebedev authored
      ----------------------------------------
      define <2 x i4> @negate_insertelement(<2 x i4> %src, i4 %a, i32 %x, <2 x i4> %b) {
      %0:
        %t0 = sub <2 x i4> { 0, 0 }, %src
        %t1 = sub i4 0, %a
        %t2 = insertelement <2 x i4> %t0, i4 %t1, i32 %x
        %t3 = sub <2 x i4> %b, %t2
        ret <2 x i4> %t3
      }
      =>
      define <2 x i4> @negate_insertelement(<2 x i4> %src, i4 %a, i32 %x, <2 x i4> %b) {
      %0:
        %t2.neg = insertelement <2 x i4> %src, i4 %a, i32 %x
        %t3 = add <2 x i4> %t2.neg, %b
        ret <2 x i4> %t3
      }
      Transformation seems to be correct!
      55430f53
    • Roman Lebedev's avatar
      [InstCombine] Negator: `extractelement` is negatible if src is negatible · ebed96fd
      Roman Lebedev authored
      ----------------------------------------
      define i4 @negate_extractelement(<2 x i4> %x, i32 %y, i4 %z) {
      %0:
        %t0 = sub <2 x i4> { 0, 0 }, %x
        call void @use_v2i4(<2 x i4> %t0)
        %t1 = extractelement <2 x i4> %t0, i32 %y
        %t2 = sub i4 %z, %t1
        ret i4 %t2
      }
      =>
      define i4 @negate_extractelement(<2 x i4> %x, i32 %y, i4 %z) {
      %0:
        %t0 = sub <2 x i4> { 0, 0 }, %x
        call void @use_v2i4(<2 x i4> %t0)
        %t1.neg = extractelement <2 x i4> %x, i32 %y
        %t2 = add i4 %t1.neg, %z
        ret i4 %t2
      }
      Transformation seems to be correct!
      ebed96fd
    • Arthur Eubanks's avatar
      Reland [X86] Codegen for preallocated · 8a887556
      Arthur Eubanks authored
      See https://reviews.llvm.org/D74651 for the preallocated IR constructs
      and LangRef changes.
      
      In X86TargetLowering::LowerCall(), if a call is preallocated, record
      each argument's offset from the stack pointer and the total stack
      adjustment. Associate the call Value with an integer index. Store the
      info in X86MachineFunctionInfo with the integer index as the key.
      
      This adds two new target independent ISDOpcodes and two new target
      dependent Opcodes corresponding to @llvm.call.preallocated.{setup,arg}.
      
      The setup ISelDAG node takes in a chain and outputs a chain and a
      SrcValue of the preallocated call Value. It is lowered to a target
      dependent node with the SrcValue replaced with the integer index key by
      looking in X86MachineFunctionInfo. In
      X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to an
      %esp adjustment, the exact amount determined by looking in
      X86MachineFunctionInfo with the integer index key.
      
      The arg ISelDAG node takes in a chain, a SrcValue of the preallocated
      call Value, and the arg index int constant. It produces a chain and the
      pointer fo the arg. It is lowered to a target dependent node with the
      SrcValue replaced with the integer index key by looking in
      X86MachineFunctionInfo. In
      X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to a
      lea of the stack pointer plus an offset determined by looking in
      X86MachineFunctionInfo with the integer index key.
      
      Force any function containing a preallocated call to use the frame
      pointer.
      
      Does not yet handle a setup without a call, or a conditional call.
      Does not yet handle musttail. That requires a LangRef change first.
      
      Tried to look at all references to inalloca and see if they apply to
      preallocated. I've made preallocated versions of tests testing inalloca
      whenever possible and when they make sense (e.g. not alloca related,
      inalloca edge cases).
      
      Aside from the tests added here, I checked that this codegen produces
      correct code for something like
      
      ```
      struct A {
              A();
              A(A&&);
              ~A();
      };
      
      void bar() {
              foo(foo(foo(foo(foo(A(), 4), 5), 6), 7), 8);
      }
      ```
      
      by replacing the inalloca version of the .ll file with the appropriate
      preallocated code. Running the executable produces the same results as
      using the current inalloca implementation.
      
      Reverted due to unexpectedly passing tests, added REQUIRES: asserts for reland.
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77689
      8a887556
    • Arthur Eubanks's avatar
      Revert "[X86] Codegen for preallocated" · b8cbff51
      Arthur Eubanks authored
      This reverts commit 810567dc.
      
      Some tests are unexpectedly passing
      b8cbff51
    • Arthur Eubanks's avatar
      [X86] Codegen for preallocated · 810567dc
      Arthur Eubanks authored
      See https://reviews.llvm.org/D74651 for the preallocated IR constructs
      and LangRef changes.
      
      In X86TargetLowering::LowerCall(), if a call is preallocated, record
      each argument's offset from the stack pointer and the total stack
      adjustment. Associate the call Value with an integer index. Store the
      info in X86MachineFunctionInfo with the integer index as the key.
      
      This adds two new target independent ISDOpcodes and two new target
      dependent Opcodes corresponding to @llvm.call.preallocated.{setup,arg}.
      
      The setup ISelDAG node takes in a chain and outputs a chain and a
      SrcValue of the preallocated call Value. It is lowered to a target
      dependent node with the SrcValue replaced with the integer index key by
      looking in X86MachineFunctionInfo. In
      X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to an
      %esp adjustment, the exact amount determined by looking in
      X86MachineFunctionInfo with the integer index key.
      
      The arg ISelDAG node takes in a chain, a SrcValue of the preallocated
      call Value, and the arg index int constant. It produces a chain and the
      pointer fo the arg. It is lowered to a target dependent node with the
      SrcValue replaced with the integer index key by looking in
      X86MachineFunctionInfo. In
      X86TargetLowering::EmitInstrWithCustomInserter() this is lowered to a
      lea of the stack pointer plus an offset determined by looking in
      X86MachineFunctionInfo with the integer index key.
      
      Force any function containing a preallocated call to use the frame
      pointer.
      
      Does not yet handle a setup without a call, or a conditional call.
      Does not yet handle musttail. That requires a LangRef change first.
      
      Tried to look at all references to inalloca and see if they apply to
      preallocated. I've made preallocated versions of tests testing inalloca
      whenever possible and when they make sense (e.g. not alloca related,
      inalloca edge cases).
      
      Aside from the tests added here, I checked that this codegen produces
      correct code for something like
      
      ```
      struct A {
              A();
              A(A&&);
              ~A();
      };
      
      void bar() {
              foo(foo(foo(foo(foo(A(), 4), 5), 6), 7), 8);
      }
      ```
      
      by replacing the inalloca version of the .ll file with the appropriate
      preallocated code. Running the executable produces the same results as
      using the current inalloca implementation.
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77689
      810567dc
    • Sam Parker's avatar
      [NFCI][CostModel] Refactor getIntrinsicInstrCost · 8cc911fa
      Sam Parker authored
      Combine the two API calls into one by introducing a structure to hold
      the relevant data. This has the added benefit of moving the boiler
      plate code for arguments and flags, into the constructors. This is
      intended to be a non-functional change, but the complicated web of
      logic involved here makes it very hard to guarantee.
      
      Differential Revision: https://reviews.llvm.org/D79941
      8cc911fa
    • Florian Hahn's avatar
      [SCEV] Move ScalarEvolutionExpander.cpp to Transforms/Utils (NFC). · bcbd26bf
      Florian Hahn authored
      SCEVExpander modifies the underlying function so it is more suitable in
      Transforms/Utils, rather than Analysis. This allows using other
      transform utils in SCEVExpander.
      
      This patch was originally committed as b8a3c34e, but broke the
      modules build, as LoopAccessAnalysis was using the Expander.
      
      The code-gen part of LAA was moved to lib/Transforms recently, so this
      patch can be landed again.
      
      Reviewers: sanjoy.google, efriedma, reames
      
      Reviewed By: sanjoy.google
      
      Differential Revision: https://reviews.llvm.org/D71537
      bcbd26bf
  3. May 19, 2020
  4. May 18, 2020
  5. May 17, 2020
  6. May 16, 2020
  7. May 15, 2020
Loading