Skip to content
  1. Apr 09, 2020
    • Christopher Tetreault's avatar
      Clean up usages of asserting vector getters in Type · 19cc9b9d
      Christopher Tetreault authored
      Summary:
      Remove usages of asserting vector getters in Type in preparation for the
      VectorType refactor. The existence of these functions complicates the
      refactor while adding little value.
      
      Reviewers: efriedma, sdesmalen, rriddle
      
      Reviewed By: sdesmalen
      
      Subscribers: hiraditya, dantrushin, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77261
      19cc9b9d
    • Christopher Tetreault's avatar
      Clean up usages of asserting vector getters in Type · 00a10324
      Christopher Tetreault authored
      Summary:
      Remove usages of asserting vector getters in Type in preparation for the
      VectorType refactor. The existence of these functions complicates the
      refactor while adding little value.
      
      Reviewers: rriddle, sdesmalen, efriedma
      
      Reviewed By: sdesmalen
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77260
      00a10324
    • Zequan Wu's avatar
      Fix lifetime call in landingpad blocking Simplifycfg pass · eccfa35d
      Zequan Wu authored
      Fix lifetime call in landingpad blocks simplifycfg from removing the
      landingpad.
      
      Reviewed By: rnk
      
      Differential Revision: https://reviews.llvm.org/D77188
      eccfa35d
    • Gil Rapaport's avatar
      [LV] Add VPValue operands to VPBlendRecipe (NFCI) · e2a18678
      Gil Rapaport authored
      InnerLoopVectorizer's code called during VPlan execution still relies on
      original IR's def-use relations to decide which vector code to generate,
      limiting VPlan transformations ability to modify def-use relations and still
      have ILV generate the vector code.
      This commit introduces VPValues for VPBlendRecipe to use as the values to
      blend. The recipe is generated with VPValues wrapping the phi's incoming values
      of the scalar phi. This reduces ingredient def-use usage by ILV as a step
      towards full VPlan-based def-use relations.
      
      Differential Revision: https://reviews.llvm.org/D77539
      e2a18678
    • Ayal Zaks's avatar
      [LV] FoldTail w/o Primary Induction · 16784892
      Ayal Zaks authored
      Introduce a new VPWidenCanonicalIVRecipe to generate a canonical vector
      induction for use in fold-tail-with-masking, if a primary induction is absent.
      
      The canonical scalar IV having start = 0 and step = VF*UF, created during code
      -gen to control the vector loop, is widened into a canonical vector IV having
      start = {<Part*VF, Part*VF+1, ..., Part*VF+VF-1> for 0 <= Part < UF} and
      step = <VF*UF, VF*UF, ..., VF*UF>.
      
      Differential Revision: https://reviews.llvm.org/D77635
      16784892
    • Sanjay Patel's avatar
      [InstCombine] replace undef in vector constant for safe shift transform (PR45447) · 812970ed
      Sanjay Patel authored
      As noted in PR45447, we have a vector-constant-with-undef-element transform bug:
      https://bugs.llvm.org/show_bug.cgi?id=45447
      
      We replace undefs with a safe constant (0 or -1) based on the (non-)negative
      predicate constraint.
      
      So this is correct:
      http://volta.cs.utah.edu:8080/z/WZE36H
      ...but this is not:
      http://volta.cs.utah.edu:8080/z/boj8gJ
      
      Previously, we were relying on getSafeVectorConstantForBinop() in the related fold (D76800).
      But that's making an assumption about what qualifies as "safe", and that assumption may
      not always hold.
      
      Differential Revision: https://reviews.llvm.org/D77739
      812970ed
    • Anton Bikineev's avatar
      tsan: don't instrument __attribute__((naked)) functions · 9e1ccec8
      Anton Bikineev authored
      Naked functions are required to not have compiler generated
      prologues/epilogues, hence no instrumentation is needed for them.
      
      Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=45400
      
      Differential Revision: https://reviews.llvm.org/D77477
      9e1ccec8
    • Florian Hahn's avatar
      [LV] Assert no DbgInfoIntrinsic calls are passed to widening (NFC). · a7efe06a
      Florian Hahn authored
      When building a VPlan, BasicBlock::instructionsWithoutDebug() is used to
      iterate over the instructions in a block. This means that no recipes
      should be created for debug info intrinsics already and we can turn the
      early exit into an assertion.
      
      Reviewers: Ayal, gilr, rengolin, aprantl
      
      Reviewed By: aprantl
      
      Differential Revision: https://reviews.llvm.org/D77636
      a7efe06a
    • Florian Hahn's avatar
      [VPlan] Add & use VPValue operands for VPWidenCallRecipe (NFC). · 9997ee23
      Florian Hahn authored
      This patch adds VPValue versions for the arguments of the call to
      VPWidenCallRecipe and uses them during code-generation.
      
      Similar to D76373 this reduces ingredient def-use usage by ILV as
      a step towards full VPlan-based def-use relations.
      
      Reviewers: Ayal, gilr, rengolin
      
      Reviewed By: gilr
      
      Differential Revision: https://reviews.llvm.org/D77655
      9997ee23
    • Jay Foad's avatar
      [KnownBits] Move AND, OR and XOR logic into KnownBits · c63aed89
      Jay Foad authored
      Summary:
      There are at least three clients for KnownBits calculations:
      ValueTracking, SelectionDAG and GlobalISel. To reduce duplication the
      common logic should be moved out of these clients and into KnownBits
      itself.
      
      This patch does this for AND, OR and XOR calculations by implementing
      and using appropriate operator overloads KnownBits::operator& etc.
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74060
      c63aed89
    • Serge Pavlov's avatar
      [FPEnv] Use single enum to represent rounding mode · c7ff5b38
      Serge Pavlov authored
      Now compiler defines 5 sets of constants to represent rounding mode.
      These are:
      
      1. `llvm::APFloatBase::roundingMode`. It specifies all 5 rounding modes
      defined by IEEE-754 and is used in `APFloat` implementation.
      
      2. `clang::LangOptions::FPRoundingModeKind`. It specifies 4 of 5 IEEE-754
      rounding modes and a special value for dynamic rounding mode. It is used
      in clang frontend.
      
      3. `llvm::fp::RoundingMode`. Defines the same values as
      `clang::LangOptions::FPRoundingModeKind` but in different order. It is
      used to specify rounding mode in in IR and functions that operate IR.
      
      4. Rounding mode representation used by `FLT_ROUNDS` (C11, 5.2.4.2.2p7).
      Besides constants for rounding mode it also uses a special value to
      indicate error. It is convenient to use in intrinsic functions, as it
      represents platform-independent representation for rounding mode. In this
      role it is used in some pending patches.
      
      5. Values like `FE_DOWNWARD` and other, which specify rounding mode in
      library calls `fesetround` and `fegetround`. Often they represent bits
      of some control register, so they are target-dependent. The same names
      (not values) and a special name `FE_DYNAMIC` are used in
      `#pragma STDC FENV_ROUND`.
      
      The first 4 sets of constants are target independent and could have the
      same numerical representation. It would simplify conversion between the
      representations. Also now `clang::LangOptions::FPRoundingModeKind` and
      `llvm::fp::RoundingMode` do not contain the value for IEEE-754 rounding
      direction `roundTiesToAway`, although it is supported natively on
      some targets.
      
      This change defines all the rounding mode type via one `llvm::RoundingMode`,
      which also contains rounding mode for IEEE rounding direction `roundTiesToAway`.
      
      Differential Revision: https://reviews.llvm.org/D77379
      c7ff5b38
    • Pratyai Mazumder's avatar
      [SanitizerCoverage] sancov/inline-bool-flag instrumentation. · e8d1c652
      Pratyai Mazumder authored
      Summary:
      New SanitizerCoverage feature `inline-bool-flag` which inserts an
      atomic store of `1` to a boolean (which is an 8bit integer in
      practice) flag on every instrumented edge.
      
      Implementation-wise it's very similar to `inline-8bit-counters`
      features. So, much of wiring and test just follows the same pattern.
      
      Reviewers: kcc, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: llvm-commits, hiraditya, jfb, cfe-commits, #sanitizers
      
      Tags: #clang, #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D77244
      e8d1c652
    • Vitaly Buka's avatar
      [NFC][SanitizerCoverage] Simplify alignment calculation · 8b1a6c0a
      Vitaly Buka authored
      This reverts commit e42f2a0cd8b8007c816d0e63f5000c444e29105e.
      8b1a6c0a
    • Johannes Doerfert's avatar
      [CallGraphUpdater] Remove dead constants before replacing a function · cb0ecc5c
      Johannes Doerfert authored
      Dead constants might be left when a function is replaced, we can
      gracefully handle this case and avoid complexity for the users who would
      see an assertion otherwise.
      cb0ecc5c
    • Craig Topper's avatar
      [InstCombine] Avoid a call to deprecated version of CreateCall. · f3d3cec6
      Craig Topper authored
      Passing a Value * to CreateCall has to call getPointerElementType
      to find the type of the pointer.
      
      In this case we can rely on the fact that Intrinsic::getDeclaration
      returns a Function * and use that version of CreateCall.
      f3d3cec6
    • Johannes Doerfert's avatar
      [Attributor][NFC] Split AbstractAttributes out of Attributor.cpp · 0985554b
      Johannes Doerfert authored
      Attributor.cpp became quite big and we need to start provide structure.
      The Attributor code is now in Attributor.cpp and the classes derived
      from AbstractAttribute are in AttributorAttributes.cpp. Minor changes
      were required but no intended functional changes.
      
      We also minimized includes as part of this.
      
      Reviewed By: baziotis
      
      Differential Revision: https://reviews.llvm.org/D76873
      0985554b
    • Christopher Tetreault's avatar
      Clean up usages of asserting vector getters in Type · 155740cc
      Christopher Tetreault authored
      Summary:
      Remove usages of asserting vector getters in Type in preparation for the
      VectorType refactor. The existence of these functions complicates the
      refactor while adding little value.
      
      Reviewers: sdesmalen, rriddle, efriedma
      
      Reviewed By: sdesmalen
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77263
      155740cc
  2. Apr 08, 2020
    • Florian Hahn's avatar
      [DSE.MSSA] Only use callCapturesBefore for calls. · bbbec716
      Florian Hahn authored
      callCapturesBefore always returns ModRef , if UseInst isn't a call. As
      we only call it if we already know Mod is set, this only destroys the
      Must bit for non-calls.
      bbbec716
    • Florian Hahn's avatar
      a6353fdf
    • Sanjay Patel's avatar
      [InstCombine] exclude bitcast of ppc_fp128 in icmp signbit fold · a1c05fe2
      Sanjay Patel authored
      Based on the post-commit comments for rG0f56bbc, there might
      be a problem with this transform:
      
      (bitcast (fpext/fptrunc X)) to iX) < 0 --> (bitcast X to iY) < 0
      
      ...and the ppc_fp128 data type, so conservatively bypass if we
      are bitcasting a ppc_fp128.
      
      We might be able to account for endian or other differences to
      enable this for PowerPC again if that is useful.
      
      Differential Revision: https://reviews.llvm.org/D77642
      a1c05fe2
    • Max Kazantsev's avatar
    • Kazu Hirata's avatar
      [JumpThreading] NFC: Simplify ComputeValueKnownInPredecessorsImpl · 91eb442f
      Kazu Hirata authored
      Summary:
      ComputeValueKnownInPredecessorsImpl is the main folding mechanism in
      JumpThreading.cpp.  To avoid potential infinite recursion while
      chasing use-def chains, it uses:
      
        DenseSet<std::pair<Value *, BasicBlock *>> &RecursionSet
      
      to keep track of Value-BB pairs that we've processed.
      
      Now, when ComputeValueKnownInPredecessorsImpl recursively calls
      itself, it always passes BB as is, so the second element is always BB.
      
      This patch simplifes the function by dropping "BasicBlock *" from
      RecursionSet.
      
      Reviewers: wmi, efriedma
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77699
      91eb442f
    • Eli Friedman's avatar
      565b56a7
    • Daniel Sanders's avatar
      Add MIR-level debugify with only locations support for now · 1adeeabb
      Daniel Sanders authored
      Summary:
      Re-used the IR-level debugify for the most part. The MIR-level code then
      adds locations to the MachineInstrs afterwards based on the LLVM-IR debug
      info.
      
      It's worth mentioning that the resulting locations make little sense as
      the range of line numbers used in a Function at the MIR level exceeds that
      of the equivelent IR level function. As such, MachineInstrs can appear to
      originate from outside the subprogram scope (and from other subprogram
      scopes). However, it doesn't seem worth worrying about as the source is
      imaginary anyway.
      
      There's a few high level goals this pass works towards:
      * We should be able to debugify our .ll/.mir in the lit tests without
        changing the checks and still pass them. I.e. Debug info should not change
        codegen. Combining this with a strip-debug pass should enable this. The
        main issue I ran into without the strip-debug pass was instructions with MMO's and
        checks on both the instruction and the MMO as the debug-location is
        between them. I currently have a simple hack in the MIRPrinter to
        resolve that but the more general solution is a proper strip-debug pass.
      * We should be able to test that GlobalISel does not lose debug info. I
        recently found that the legalizer can be unexpectedly lossy in seemingly
        simple cases (e.g. expanding one instr into many). I have a verifier
        (will be posted separately) that can be integrated with passes that use
        the observer interface and will catch location loss (it does not verify
        correctness, just that there's zero lossage). It is a little conservative
        as the line-0 locations that arise from conflicts do not track the
        conflicting locations but it can still catch a fair bit.
      
      Depends on D77439, D77438
      
      Reviewers: aprantl, bogner, vsk
      
      Subscribers: mgorny, hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77446
      1adeeabb
    • Fangrui Song's avatar
      [ThinLTO] Drop dso_local if a GlobalVariable satisfies isDeclarationForLinker() · d2ef8c1f
      Fangrui Song authored
      dso_local leads to direct access even if the definition is not within this compilation unit (it is
      still in the same linkage unit). On ELF, such a relocation (e.g. R_X86_64_PC32) referencing a
      STB_GLOBAL STV_DEFAULT object can cause a linker error in a -shared link.
      
      If the linkage is changed to available_externally, the dso_local flag should be dropped, so that no
      direct access will be generated.
      
      The current behavior is benign, because -fpic does not assume dso_local
      (clang/lib/CodeGen/CodeGenModule.cpp:shouldAssumeDSOLocal).
      If we do that for -fno-semantic-interposition (D73865), there will be an
      R_X86_64_PC32 linker error without this patch.
      
      Reviewed By: tejohnson
      
      Differential Revision: https://reviews.llvm.org/D74751
      d2ef8c1f
  3. Apr 07, 2020
    • Florian Hahn's avatar
      [SCCP] Use ranges for predicate info conditions. · 6aabb109
      Florian Hahn authored
      This patch updates the code that deals with conditions from predicate
      info to make use of constant ranges.
      
      For ssa_copy instructions inserted by PredicateInfo, we have 2 ranges:
      1. The range of the original value.
      2. The range imposed by the linked condition.
      
      1. is known, 2. can be determined using makeAllowedICmpRegion. The
      intersection of those ranges is the range for the copy.
      
      With this patch, we get a nice increase in the number of instructions
      eliminated by both SCCP and IPSCCP for some benchmarks:
      
      For MultiSource, SPEC2000 & SPEC2006:
      
      Tests: 237
      Same hash: 170 (filtered out)
      Remaining: 67
      Metric: sccp.NumInstRemoved
      Program                                        base    patch   diff
       test-suite...Source/Benchmarks/sim/sim.test    10.00   71.00  610.0%
       test-suite...CFP2000/177.mesa/177.mesa.test   361.00  1626.00 350.4%
       test-suite...encode/alacconvert-encode.test   141.00  602.00  327.0%
       test-suite...decode/alacconvert-decode.test   141.00  602.00  327.0%
       test-suite...CI_Purple/SMG2000/smg2000.test   1639.00 4093.00 149.7%
       test-suite...peg2/mpeg2dec/mpeg2decode.test    75.00  163.00  117.3%
       test-suite...T2006/401.bzip2/401.bzip2.test   358.00  513.00  43.3%
       test-suite...rks/FreeBench/pifft/pifft.test    11.00   15.00  36.4%
       test-suite...langs-C/unix-tbl/unix-tbl.test     4.00    5.00  25.0%
       test-suite...lications/sqlite3/sqlite3.test   541.00  667.00  23.3%
       test-suite.../CINT2000/254.gap/254.gap.test   243.00  299.00  23.0%
       test-suite...ks/Prolangs-C/agrep/agrep.test    25.00   29.00  16.0%
       test-suite...marks/7zip/7zip-benchmark.test   1135.00 1304.00 14.9%
       test-suite...lications/ClamAV/clamscan.test   1105.00 1268.00 14.8%
       test-suite...urce/Applications/lua/lua.test   398.00  436.00   9.5%
      
      Metric: sccp.IPNumInstRemoved
      Program                                        base   patch   diff
       test-suite...C/CFP2000/179.art/179.art.test     1.00   3.00  200.0%
       test-suite...006/447.dealII/447.dealII.test   429.00 1056.00 146.2%
       test-suite...nch/fourinarow/fourinarow.test     3.00   7.00  133.3%
       test-suite...CI_Purple/SMG2000/smg2000.test   818.00 1748.00 113.7%
       test-suite...ks/McCat/04-bisect/bisect.test     3.00   5.00  66.7%
       test-suite...CFP2000/177.mesa/177.mesa.test   165.00 255.00  54.5%
       test-suite...ediabench/gsm/toast/toast.test    18.00  27.00  50.0%
       test-suite...telecomm-gsm/telecomm-gsm.test    18.00  27.00  50.0%
       test-suite...ks/Prolangs-C/agrep/agrep.test    24.00  35.00  45.8%
       test-suite...TimberWolfMC/timberwolfmc.test    43.00  62.00  44.2%
       test-suite...encode/alacconvert-encode.test    46.00  66.00  43.5%
       test-suite...decode/alacconvert-decode.test    46.00  66.00  43.5%
       test-suite...langs-C/unix-tbl/unix-tbl.test    12.00  17.00  41.7%
       test-suite...peg2/mpeg2dec/mpeg2decode.test    31.00  41.00  32.3%
       test-suite.../CINT2000/254.gap/254.gap.test   117.00 154.00  31.6%
      
      Reviewers: efriedma, davide
      
      Reviewed By: efriedma
      
      Differential Revision: https://reviews.llvm.org/D76611
      6aabb109
    • Jun Ma's avatar
      46bff786
    • Eli Friedman's avatar
      [NFC] Modernize misc. uses of Align/MaybeAlign APIs. · 3f13ee8a
      Eli Friedman authored
      Use the current getAlign() APIs where it makes sense, and use Align
      instead of MaybeAlign when we know the value is non-zero.
      3f13ee8a
    • Eli Friedman's avatar
      Remove SequentialType from the type heirarchy. · 68b03aee
      Eli Friedman authored
      Now that we have scalable vectors, there's a distinction that isn't
      getting captured in the original SequentialType: some vectors don't have
      a known element count, so counting the number of elements doesn't make
      sense.
      
      In some cases, there's a better way to express the commonality using
      other methods. If we're dealing with GEPs, there's GEP methods; if we're
      dealing with a ConstantDataSequential, we can query its element type
      directly.
      
      In the relatively few remaining cases, I just decided to write out
      the type checks. We're talking about relatively few places, and I think
      the abstraction doesn't really carry its weight. (See thread "[RFC]
      Refactor class hierarchy of VectorType in the IR" on llvmdev.)
      
      Differential Revision: https://reviews.llvm.org/D75661
      68b03aee
    • Vedant Kumar's avatar
      [AddressSanitizer] Fix for wrong argument values appearing in backtraces · 5f185a89
      Vedant Kumar authored
      Summary:
      In some cases, ASan may insert instrumentation before function arguments
      have been stored into their allocas. This causes two issues:
      
      1) The argument value must be spilled until it can be stored into the
         reserved alloca, wasting a stack slot.
      
      2) Until the store occurs in a later basic block, the debug location
         will point to the wrong frame offset, and backtraces will show an
         uninitialized value.
      
      The proposed solution is to move instructions which initialize allocas
      for arguments up into the entry block, before the position where ASan
      starts inserting its instrumentation.
      
      For the motivating test case, before the patch we see:
      
      ```
       | 0033: movq %rdi, 0x68(%rbx)  |   | DW_TAG_formal_parameter     |
       | ...                          |   |   DW_AT_name ("a")          |
       | 00d1: movq 0x68(%rbx), %rsi  |   |   DW_AT_location (RBX+0x90) |
       | 00d5: movq %rsi, 0x90(%rbx)  |   |       ^ not correct ...     |
      ```
      
      and after the patch we see:
      
      ```
       | 002f: movq %rdi, 0x70(%rbx)  |   | DW_TAG_formal_parameter     |
       |                              |   |   DW_AT_name ("a")          |
       |                              |   |   DW_AT_location (RBX+0x70) |
      ```
      
      rdar://61122691
      
      Reviewers: aprantl, eugenis
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77182
      5f185a89
    • Daniel Sanders's avatar
      Add option to limit Debugify to locations (omitting variables) · 15f7bc78
      Daniel Sanders authored
      Summary:
      It can be helpful to test behaviour w.r.t locations without having DEBUG_VALUE
      around. In particular, because DEBUG_VALUE has the potential to change CodeGen
      behaviour (e.g. hasOneUse() vs hasOneNonDbgUse()) while locations generally
      don't.
      
      Reviewers: aprantl, bogner
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D77438
      15f7bc78
  4. Apr 06, 2020
Loading