Skip to content
  1. Aug 16, 2017
  2. Aug 15, 2017
  3. Aug 14, 2017
    • Craig Topper's avatar
      Recommit r310869, "[InstSimplify][InstCombine] Modify the interface of... · 0aa3a195
      Craig Topper authored
      Recommit r310869, "[InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and use it in the InstSimplify"
      
      This recommits r310869, with the moved files and no extra changes.
      
      Original commit message:
      
      This addresses a fixme in InstSimplify about using decomposeBitTest. This also fixes InstSimplify to handle ugt and ult compares too.
      
      I've modified the interface a little to return only the APInt version of the mask that InstSimplify needs. InstCombine now has a small wrapper routine to create a Constant out of it. I've also dropped the returning of 0 since InstSimplify doesn't need that. So InstCombine creates a zero constant itself.
      
      I also had to make decomposeBitTest support vectors since InstSimplify needs that.
      
      As InstSimplify can't use something from the Transforms library, I've moved the CmpInstAnalysis code to the Analysis library.
      
      Differential Revision: https://reviews.llvm.org/D36593
      
      llvm-svn: 310889
      0aa3a195
    • Andrew Kaylor's avatar
      Add strictfp attribute to prevent unwanted optimizations of libm calls · 53a5fbb4
      Andrew Kaylor authored
      Differential Revision: https://reviews.llvm.org/D34163
      
      llvm-svn: 310885
      53a5fbb4
    • Craig Topper's avatar
      Revert r310869 "[InstSimplify][InstCombine] Modify the interface of... · 69fa8e0d
      Craig Topper authored
      Revert r310869 "[InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and use it in the InstSimplify"
      
      Failed to add the two files that moved. And then added an extra change I didn't mean to while trying to fix that. Reverting everything.
      
      llvm-svn: 310873
      69fa8e0d
    • Craig Topper's avatar
      [InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and... · 2f0b4506
      Craig Topper authored
      [InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and use it in the InstSimplify
      
      This addresses a fixme in InstSimplify about using decomposeBitTest. This also fixes InstSimplify to handle ugt and ult compares too.
      
      I've modified the interface a little to return only the APInt version of the mask that InstSimplify needs. InstCombine now has a small wrapper routine to create a Constant out of it. I've also dropped the returning of 0 since InstSimplify doesn't need that. So InstCombine creates a zero constant itself.
      
      I also had to make decomposeBitTest support vectors since InstSimplify needs that.
      
      As InstSimplify can't use something from the Transforms library, I've moved the CmpInstAnalysis code to the Analysis library.
      
      Differential Revision: https://reviews.llvm.org/D36593
      
      llvm-svn: 310869
      2f0b4506
    • Sam Parker's avatar
      [LoopUnroll] Enable option to peel remainder loop · 718c8a6a
      Sam Parker authored
      On some targets, the penalty of executing runtime unrolling checks
      and then not the unrolled loop can be significantly detrimental to
      performance. This results in the need to be more conservative with
      the unroll count, keeping a trip count of 2 reduces the overhead as
      well as increasing the chance of the unrolled body being executed. But
      being conservative leaves performance gains on the table.
      
      This patch enables the unrolling of the remainder loop introduced by
      runtime unrolling. This can help reduce the overhead of misunrolled
      loops because the cost of non-taken branches is much less than the
      cost of the backedge that would normally be executed in the remainder
      loop. This allows larger unroll factors to be used without suffering
      performance loses with smaller iteration counts.
      
      Differential Revision: https://reviews.llvm.org/D36309
      
      llvm-svn: 310824
      718c8a6a
  4. Aug 10, 2017
    • Craig Topper's avatar
      [DebugCounter] Move the semicolon out of the DEBUG_COUNTER macro and require... · 9cd976d0
      Craig Topper authored
      [DebugCounter] Move the semicolon out of the DEBUG_COUNTER macro and require it to be placed at the end of each use.
      
      This make it consistent with STATISTIC which it will often appears near.
      
      While there move one DEBUG_COUNTER instance out of an anonymous namespace. It's already declaring a static variable so the namespace is unnecessary.
      
      llvm-svn: 310637
      9cd976d0
  5. Aug 03, 2017
    • Ewan Crawford's avatar
      [Cloning] Move distinct GlobalVariable debug info metadata in CloneModule · e18490c8
      Ewan Crawford authored
      Duplicating the distinct Subprogram and CU metadata nodes seems like the incorrect thing to do in CloneModule for GlobalVariable debug info. As it results in the scope of the GlobalVariable DI no longer being consistent with the rest of the module, and the new CU is absent from llvm.dbg.cu.
      
      Fixed by adding RF_MoveDistinctMDs to MapMetadata flags for GlobalVariables.
      
      Current unit test IR after clone:
      ```
      @gv = global i32 1, comdat($comdat), !dbg !0, !type !5
      
      define private void @f() comdat($comdat) personality void ()* @persfn !dbg !14 {
      
      !llvm.dbg.cu = !{!10}
      
      !0 = !DIGlobalVariableExpression(var: !1)
      !1 = distinct !DIGlobalVariable(name: "gv", linkageName: "gv", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true)
      !2 = distinct !DISubprogram(name: "f", linkageName: "f", scope: null, file: !3, line: 4, type: !4, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !6, variables: !5)
      !3 = !DIFile(filename: "filename.c", directory: "/file/dir/")
      !4 = !DISubroutineType(types: !5)
      !5 = !{}
      !6 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "CloneModule", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, globals: !8)
      !7 = !DIFile(filename: "filename.c", directory: "/file/dir")
      !8 = !{!0}
      !9 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
      !10 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "CloneModule", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, globals: !11)
      !11 = !{!12}
      !12 = !DIGlobalVariableExpression(var: !13)
      !13 = distinct !DIGlobalVariable(name: "gv", linkageName: "gv", scope: !14, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true)
      !14 = distinct !DISubprogram(name: "f", linkageName: "f", scope: null, file: !3, line: 4, type: !4, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !10, variables: !5)
      ```
      
      Patched IR after clone:
      ```
      @gv = global i32 1, comdat($comdat), !dbg !0, !type !5
      
      define private void @f() comdat($comdat) personality void ()* @persfn !dbg !2 {
      
      !llvm.dbg.cu = !{!6}
      
      !0 = !DIGlobalVariableExpression(var: !1)
      !1 = distinct !DIGlobalVariable(name: "gv", linkageName: "gv", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true)
      !2 = distinct !DISubprogram(name: "f", linkageName: "f", scope: null, file: !3, line: 4, type: !4, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !6, variables: !5)
      !3 = !DIFile(filename: "filename.c", directory: "/file/dir/")
      !4 = !DISubroutineType(types: !5)
      !5 = !{}
      !6 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "CloneModule", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, globals: !8)
      !7 = !DIFile(filename: "filename.c", directory: "/file/dir")
      !8 = !{!0}
      !9 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
      ```
      
      Reviewers: aprantl, probinson, dblaikie, echristo, loladiro
      Reviewed By: aprantl
      Subscribers: llvm-commits
      Differential Revision: https://reviews.llvm.org/D36082
      
      llvm-svn: 309928
      e18490c8
  6. Aug 02, 2017
  7. Aug 01, 2017
  8. Jul 29, 2017
  9. Jul 28, 2017
  10. Jul 27, 2017
    • Daniel Neilson's avatar
      All libcalls should be considered to be GC-leaf functions. · 2574d7cb
      Daniel Neilson authored
      Summary:
      It is possible for some passes to materialize a call to a libcall (ex: ldexp, exp2, etc),
      but these passes will not mark the call as a gc-leaf-function. All libcalls are
      actually gc-leaf-functions, so we change llvm::callsGCLeafFunction() to tell us that
      available libcalls are equivalent to gc-leaf-function calls.
      
      Reviewers: sanjoy, anna, reames
      
      Reviewed By: anna
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D35840
      
      llvm-svn: 309291
      2574d7cb
    • David Blaikie's avatar
      Fix assert from r309278 · 72c0b1cc
      David Blaikie authored
      llvm-svn: 309281
      72c0b1cc
    • David Blaikie's avatar
      ThinLTO: Don't import aliases of any kind (even linkonce_odr) · 2f0cc477
      David Blaikie authored
      Summary:
      Until a more advanced version of importing can be implemented for
      aliases (one that imports an alias as an available_externally definition
      of the aliasee), skip the narrow subset of cases that was possible but
      came at a cost: aliases of linkonce_odr functions could be imported
      because the linkonce_odr function could be safely duplicated from the
      source module. This came/comes at the cost of not being able to 'home'
      imported linkonce functions (they had to be emitted linkonce_odr in all
      the destination modules (even if they weren't used by an alias) rather
      than as available_externally - causing extra object size).
      
      Tangentially, this also was the only reason ThinLTO would emit multiple
      CUs in to the resulting DWARF - which happens to be a problem for
      Fission (there's a fix for this in GDB but not released yet, etc).
      (actually it's not the only reason - but I'm sending a patch to fix the
      other reason shortly)
      
      There's no reason to believe this particularly narrow alias importing
      was especially/meaningfully important, only that it was /possible/ to
      implement in this way. When a more general solution is done, it should
      still satisfy the DWARF concerns above, since the import will still be
      available_externally, and thus not create extra CUs.
      
      Since now all aliases are treated the same, I removed/simplified some
      test cases since they were testing corner cases where there are no
      longer any corners.
      
      Reviewers: tejohnson, mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D35875
      
      llvm-svn: 309278
      2f0cc477
  11. Jul 26, 2017
    • Adam Nemet's avatar
      Migrate SimplifyLibCalls to new OptimizationRemarkEmitter · ea06e6e8
      Adam Nemet authored
      Summary:
      This changes SimplifyLibCalls to use the new OptimizationRemarkEmitter
      API.
      
      In fact, as SimplifyLibCalls is only ever called via InstCombine,
      (as far as I can tell) the OptimizationRemarkEmitter is added there,
      and then passed through to SimplifyLibCalls later.
      
      I have avoided changing any remark text.
      
      This closes PR33787
      
      Patch by Sam Elliott!
      
      Reviewers: anemet, davide
      
      Reviewed By: anemet
      
      Subscribers: davide, mehdi_amini, eraman, fhahn, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D35608
      
      llvm-svn: 309158
      ea06e6e8
  12. Jul 21, 2017
    • Anna Thomas's avatar
      [RuntimeUnroll] NFC: Add a profitability function for mutliexit loop · 5c07a4c5
      Anna Thomas authored
      Separated out the profitability from the safety analysis for multiexit
      loop unrolling. Currently, this is an NFC because profitability is true
      only if the unroll-runtime-multi-exit is set to true (off-by-default).
      
      This is to ease adding the profitability heuristic up for review at
      D35380.
      
      llvm-svn: 308753
      5c07a4c5
  13. Jul 19, 2017
    • Dinar Temirbulatov's avatar
      [LoopUtils] Add an extra parameter OpValue to propagateIRFlags function, · a61f4b89
      Dinar Temirbulatov authored
      If OpValue is non-null, we only consider operations similar to OpValue
      when intersecting.
      
      Differential Revision: https://reviews.llvm.org/D35292
      
      llvm-svn: 308428
      a61f4b89
    • Balaram Makam's avatar
      [SimplifyCFG] Defer folding unconditional branches to LateSimplifyCFG if it... · b05a5578
      Balaram Makam authored
      [SimplifyCFG] Defer folding unconditional branches to LateSimplifyCFG if it can destroy canonical loop structure.
      
      Summary:
      When simplifying unconditional branches from empty blocks, we pre-test if the
      BB belongs to a set of loop headers and keep the block to prevent passes from
      destroying canonical loop structure. However, the current algorithm fails if
      the destination of the branch is a loop header. Especially when such a loop's
      latch block is folded into loop header it results in additional backedges and
      LoopSimplify turns it into a nested loop which prevent later optimizations
      from being applied (e.g., loop  unrolling and loop interleaving).
      
      This patch augments the existing algorithm by further checking if the
      destination of the branch belongs to a set of loop headers and defer
      eliminating it if yes to LateSimplifyCFG.
      
      Fixes PR33605: https://bugs.llvm.org/show_bug.cgi?id=33605
      
      Reviewers: efriedma, mcrosier, pacxx, hsung, davidxl
      
      Reviewed By: efriedma
      
      Subscribers: ashutosh.nema, gberry, javed.absar, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D35411
      
      llvm-svn: 308422
      b05a5578
  14. Jul 13, 2017
  15. Jul 12, 2017
    • Anna Thomas's avatar
      [LoopUnrollRuntime] NFC: Refactored safety checks of unrolling multi-exit loop · 8e431a98
      Anna Thomas authored
      Refactored the code and separated out a function
      `canSafelyUnrollMultiExitLoop` to reduce redundant checks and make it
      easier to add profitability heuristics later.
      Added tests to runtime unrolling to make sure that unrolling for
      multi-exit loops is not done unless the option
      -unroll-runtime-multi-exit is true.
      
      llvm-svn: 307843
      8e431a98
    • Konstantin Zhuravlyov's avatar
      Enhance synchscope representation · bb80d3e1
      Konstantin Zhuravlyov authored
        OpenCL 2.0 introduces the notion of memory scopes in atomic operations to
        global and local memory. These scopes restrict how synchronization is
        achieved, which can result in improved performance.
      
        This change extends existing notion of synchronization scopes in LLVM to
        support arbitrary scopes expressed as target-specific strings, in addition to
        the already defined scopes (single thread, system).
      
        The LLVM IR and MIR syntax for expressing synchronization scopes has changed
        to use *syncscope("<scope>")*, where <scope> can be "singlethread" (this
        replaces *singlethread* keyword), or a target-specific name. As before, if
        the scope is not specified, it defaults to CrossThread/System scope.
      
        Implementation details:
          - Mapping from synchronization scope name/string to synchronization scope id
            is stored in LLVM context;
          - CrossThread/System and SingleThread scopes are pre-defined to efficiently
            check for known scopes without comparing strings;
          - Synchronization scope names are stored in SYNC_SCOPE_NAMES_BLOCK in
            the bitcode.
      
      Differential Revision: https://reviews.llvm.org/D21723
      
      llvm-svn: 307722
      bb80d3e1
  16. Jul 11, 2017
  17. Jul 10, 2017
    • Leo Li's avatar
      [ConstantHoisting] Remove dupliate logic in constant hoisting · 93abd7d9
      Leo Li authored
      Summary:
      As metioned in https://reviews.llvm.org/D34576, checkings in
      `collectConstantCandidates` can be replaced by using
      `llvm::canReplaceOperandWithVariable`.
      
      The only special case is that `collectConstantCandidates` return false for
      all `IntrinsicInst` but it is safe for us to collect constant candidates from
      `IntrinsicInst`.
      
      Reviewers: pirama, efriedma, srhines
      
      Reviewed By: efriedma
      
      Subscribers: llvm-commits, javed.absar
      
      Differential Revision: https://reviews.llvm.org/D34921
      
      llvm-svn: 307587
      93abd7d9
    • Anna Thomas's avatar
      [LoopUnrollRuntime] Remove strict assert about VMap requirement · 70ffd65c
      Anna Thomas authored
      When unrolling under multiple exits which is under off-by-default option,
      the assert that checks for VMap entry in loop exit values is too strong.
      (assert if VMap entry did not exist, the value should be a
      constant). However, values derived from
      constants or from values outside loop, does not have a VMap entry too.
      
      Removed the assert and added a testcase showcasing the property for
      non-constant values.
      
      llvm-svn: 307542
      70ffd65c
  18. Jul 09, 2017
  19. Jul 08, 2017
  20. Jul 07, 2017
    • Anna Thomas's avatar
      [LoopUnrollRuntime] Support multiple exit blocks unrolling when prolog remainder generated · e3872003
      Anna Thomas authored
      With the NFC refactoring in rL307417 (git SHA 987dd01), all the logic
      is in place to support multiple exit/exiting blocks when prolog
      remainder is generated.
      This patch removed the assert that multiple exit blocks unrolling is only
      supported when epilog remainder is generated.
      
      Also, added test runs and checks with PROLOG prefix in
      runtime-loop-multiple-exits.ll test cases.
      
      llvm-svn: 307435
      e3872003
    • Davide Italiano's avatar
      [Local] Update the comment for removeUnreachableBlocks. · 4eb210bd
      Davide Italiano authored
      It referenced a wrong function name, and didn't mention what the
      second argument did. This should be slightly more accurate now.
      
      llvm-svn: 307425
      4eb210bd
    • Gor Nishanov's avatar
      [cloning] Do not duplicate types when cloning functions · 8cdf6487
      Gor Nishanov authored
      Summary:
      This is an addon to the change rl304488 cloning fixes. (Originally rl304226 reverted rl304228 and reapplied rl304488 https://reviews.llvm.org/D33655)
      
      rl304488 works great when DILocalVariables that comes from the inlined function has a 'unique-ed' type, but,
      in the case when the variable type is distinct we will create a second DILocalVariable in the scope of the original function that was inlined.
      
      Consider cloning of the following function:
      ```
      define private void @f() !dbg !5 {
        %1 = alloca i32, !dbg !11
        call void @llvm.dbg.declare(metadata i32* %1, metadata !14, metadata !12), !dbg !18
        ret void, !dbg !18
      }
      
      !14 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !17) ; came from an inlined function
      !15 = distinct !DISubprogram(name: "inlined", linkageName: "inlined", scope: null, file: !6, line: 8, type: !7, isLocal: true, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !0, variables: !16)
      !16 = !{!14}
      !17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32)
      ```
      
      Without this fix, when function 'f' is cloned, we will create another DILocalVariable for "inlined", due to its type being distinct.
      
      ```
      define private void @f.1() !dbg !23 {
        %1 = alloca i32, !dbg !26
        call void @llvm.dbg.declare(metadata i32* %1, metadata !28, metadata !12), !dbg !30
        ret void, !dbg !30
      }
      
      !14 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !17)
      !15 = distinct !DISubprogram(name: "inlined", linkageName: "inlined", scope: null, file: !6, line: 8, type: !7, isLocal: true, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !0, variables: !16)
      !16 = !{!14}
      !17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32)
       ;
      !28 = !DILocalVariable(name: "inlined", scope: !15, file: !6, line: 5, type: !29) ; OOPS second DILocalVariable
      !29 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "some_struct", size: 32, align: 32)
      ```
      
      Now we have two DILocalVariable for "inlined" within the same scope. This result in assert in AsmPrinter/DwarfDebug.h:131: void llvm::DbgVariable::addMMIEntry(const llvm::DbgVariable &): Assertion `V.Var == Var && "conflicting variable"' failed.
      (Full example: See: https://bugs.llvm.org/show_bug.cgi?id=33492)
      
      In this change we prevent duplication of types so that when a metadata for DILocalVariable is cloned it will get uniqued to the same metadate node as an original variable.
      
      Reviewers: loladiro, dblaikie, aprantl, echristo
      
      Reviewed By: loladiro
      
      Subscribers: EricWF, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D35106
      
      llvm-svn: 307418
      8cdf6487
    • Anna Thomas's avatar
      [LoopUnrollRuntime] NFC: use the precomputed loop exit in ConnectProlog · 734ab3f7
      Anna Thomas authored
      Minor refactoring to use the preexisting loop exit that's already
      calculated. We do not need to recompute the loop exit in ConnectProlog.
      Apart from avoiding redundant computation, this is required for
      supporting multiple loop exits when Prolog remainder loops are generated.
      
      llvm-svn: 307417
      734ab3f7
    • Sean Fertile's avatar
      Extend memcpy expansion in Transform/Utils to handle wider operand types. · 9cd1cdf8
      Sean Fertile authored
      Adds loop expansions for known-size and unknown-sized memcpy calls, allowing the
      target to provide the operand types through TTI callbacks. The default values
      for the TTI callbacks use int8 operand types and matches the existing behaviour
      if they aren't overridden by the target.
      
      Differential revision: https://reviews.llvm.org/D32536
      
      llvm-svn: 307346
      9cd1cdf8
  21. Jul 06, 2017
Loading