Skip to content
  1. Jun 18, 2018
  2. Jun 04, 2018
    • David Blaikie's avatar
      Move Analysis/Utils/Local.h back to Transforms · 31b98d2e
      David Blaikie authored
      Review feedback from r328165. Split out just the one function from the
      file that's used by Analysis. (As chandlerc pointed out, the original
      change only moved the header and not the implementation anyway - which
      was fine for the one function that was used (since it's a
      template/inlined in the header) but not in general)
      
      llvm-svn: 333954
      31b98d2e
  3. May 09, 2018
    • 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
  4. Apr 20, 2018
    • Michael Zolotukhin's avatar
      Revert "Revert r330403 and r330413." · a2c9af02
      Michael Zolotukhin authored
      Reapply the patches with a fix. Thanks Ilya and Hans for the reproducer!
      This reverts commit r330416.
      
      The issue was that removing predecessors invalidated uses that we stored
      for rewrite. The fix is to finish manipulating with CFG before we select
      uses for rewrite.
      
      llvm-svn: 330431
      a2c9af02
    • Ilya Biryukov's avatar
      Revert r330403 and r330413. · afe822bd
      Ilya Biryukov authored
      Revert r330413: "[SSAUpdaterBulk] Use SmallVector instead of DenseMap for storing rewrites."
      Revert r330403 "Reapply "[PR16756] Use SSAUpdaterBulk in JumpThreading." one more time."
      
      r330403 commit seems to crash clang during our integrate while doing PGO build with the following stacktrace:
            #2 llvm::SSAUpdaterBulk::RewriteAllUses(llvm::DominatorTree*, llvm::SmallVectorImpl<llvm::PHINode*>*)
            #3 llvm::JumpThreadingPass::ThreadEdge(llvm::BasicBlock*, llvm::SmallVectorImpl<llvm::BasicBlock*> const&, llvm::BasicBlock*)
            #4 llvm::JumpThreadingPass::ProcessThreadableEdges(llvm::Value*, llvm::BasicBlock*, llvm::jumpthreading::ConstantPreference, llvm::Instruction*)
            #5 llvm::JumpThreadingPass::ProcessBlock(llvm::BasicBlock*)
      The crash happens while compiling 'lib/Analysis/CallGraph.cpp'.
      
      r3340413 is reverted due to conflicting changes.
      
      llvm-svn: 330416
      afe822bd
    • Michael Zolotukhin's avatar
      9dea0793
  5. Apr 10, 2018
    • Michael Zolotukhin's avatar
      [PR16756] Add SSAUpdaterBulk. · 52b064f3
      Michael Zolotukhin authored
      Summary:
      SSAUpdater is a bottleneck in a number of passes, and one of the reasons
      is that it performs a lot of unnecessary computations (DT/IDF) over and
      over again. This patch adds a new SSAUpdaterBulk that uses existing DT
      and avoids recomputing IDF when possible.
      
      Reviewers: dberlin, davide, MatzeB
      
      Subscribers: llvm-commits, hiraditya
      
      Differential Revision: https://reviews.llvm.org/D44282
      
      llvm-svn: 329643
      52b064f3
  6. Mar 21, 2018
    • David Blaikie's avatar
      Fix a couple of layering violations in Transforms · 2be39228
      David Blaikie authored
      Remove #include of Transforms/Scalar.h from Transform/Utils to fix layering.
      
      Transforms depends on Transforms/Utils, not the other way around. So
      remove the header and the "createStripGCRelocatesPass" function
      declaration (& definition) that is unused and motivated this dependency.
      
      Move Transforms/Utils/Local.h into Analysis because it's used by
      Analysis/MemoryBuiltins.cpp.
      
      llvm-svn: 328165
      2be39228
  7. Mar 06, 2018
  8. Mar 02, 2018
    • Vedant Kumar's avatar
      [Utils] Salvage debug info in block simplification · f69baf64
      Vedant Kumar authored
      In stage2 -O3 builds of llc, this results in small but measurable
      increases in the number of variables with locations, and in the number
      of unique source variables overall.
      
      (According to llvm-dwarfdump --statistics, there are 123 additional
      variables with locations, which is just a 0.006% improvement).
      
      The size of the .debug_loc section of the llc dsym increases by 0.004%.
      
      llvm-svn: 326629
      f69baf64
    • Vedant Kumar's avatar
      [Utils] Salvage debug info in recursive inst deletion · 334fa574
      Vedant Kumar authored
      In stage2 -O3 builds of llc, this results in a 0.3% increase in the
      number of variables with locations, and a 0.2% increase in the number of
      unique source variables overall.
      
      The size of the .debug_loc section of the llc dsym increases by 0.5%.
      
      llvm-svn: 326621
      334fa574
    • Vedant Kumar's avatar
      [unittests] Make some parseIR calls more readable, NFC · 1425e041
      Vedant Kumar authored
      llvm-svn: 326620
      1425e041
  9. Feb 28, 2018
  10. Feb 14, 2018
  11. Jan 31, 2018
  12. Jan 17, 2018
  13. Dec 08, 2017
  14. Nov 18, 2017
  15. Nov 16, 2017
  16. Oct 26, 2017
  17. Oct 25, 2017
  18. Oct 06, 2017
    • Jakub Kuderski's avatar
      [CodeExtractor] Fix multiple bugs under certain shape of extracted region · cbe9fae9
      Jakub Kuderski authored
      Summary:
      If the extracted region has multiple exported data flows toward the same BB which is not included in the region, correct resotre instructions and PHI nodes won't be generated inside the exitStub. The solution is simply put the restore instructions right after the definition of output values instead of putting in exitStub.
      Unittest for this bug is included.
      
      Author: myhsu
      
      Reviewers: chandlerc, davide, lattner, silvas, davidxl, wmi, kuhar
      
      Subscribers: dberlin, kuhar, mgorny, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D37902
      
      llvm-svn: 315041
      cbe9fae9
  19. Sep 28, 2017
    • Sanjoy Das's avatar
      Use a BumpPtrAllocator for Loop objects · def1729d
      Sanjoy Das authored
      Summary:
      And now that we no longer have to explicitly free() the Loop instances, we can
      (with more ease) use the destructor of LoopBase to do what LoopBase::clear() was
      doing.
      
      Reviewers: chandlerc
      
      Subscribers: mehdi_amini, mcrosier, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D38201
      
      llvm-svn: 314375
      def1729d
  20. Sep 22, 2017
  21. Sep 21, 2017
    • Reid Kleckner's avatar
      Re-land r313825: "[IR] Add llvm.dbg.addr, a control-dependent version of llvm.dbg.declare" · 0fe506bc
      Reid Kleckner authored
      The fix is to avoid invalidating our insertion point in
      replaceDbgDeclare:
           Builder.insertDeclare(NewAddress, DIVar, DIExpr, Loc, InsertBefore);
      +    if (DII == InsertBefore)
      +      InsertBefore = &*std::next(InsertBefore->getIterator());
           DII->eraseFromParent();
      
      I had to write a unit tests for this instead of a lit test because the
      use list order matters in order to trigger the bug.
      
      The reduced C test case for this was:
        void useit(int*);
        static inline void inlineme() {
          int x[2];
          useit(x);
        }
        void f() {
          inlineme();
          inlineme();
        }
      
      llvm-svn: 313905
      0fe506bc
  22. Sep 20, 2017
    • Sanjoy Das's avatar
      [LoopInfo] Make LoopBase and Loop destructors non-public · 76ab2323
      Sanjoy Das authored
      Summary:
      See comment for why I think this is a good idea.
      
      This change also:
      
       - Removes an SCEV test case.  The SCEV test was not testing anything useful (most of it was `#if 0` ed out) and it would need to be updated to deal with a private ~Loop::Loop.
       - Updates the loop pass manager test case to deal with a private ~Loop::Loop.
       - Renames markAsRemoved to markAsErased to contrast with removeLoop, via the usual remove vs. erase idiom we already have for instructions and basic blocks.
      
      Reviewers: chandlerc
      
      Subscribers: mehdi_amini, mcrosier, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D37996
      
      llvm-svn: 313695
      76ab2323
  23. 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
  24. Jul 28, 2017
  25. Jul 07, 2017
    • 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
  26. Jun 14, 2017
  27. Jun 06, 2017
  28. Jun 02, 2017
  29. May 30, 2017
    • Keno Fischer's avatar
      Revert "[Cloning] Take another pass at properly cloning debug info" · 3fa5db4c
      Keno Fischer authored
      At least one build bot is complaining. Will investigate after lunch.
      
      llvm-svn: 304228
      3fa5db4c
    • Keno Fischer's avatar
      [Cloning] Take another pass at properly cloning debug info · 945dc1d2
      Keno Fischer authored
      Summary:
      In rL302576, DISubprograms gained the constraint that a !dbg attachments to functions must
      have a 1:1 mapping to DISubprograms. As part of that change, the function cloning support
      was adjusted to attempt to enforce this invariant during cloning. However, there
      were several problems with the implementation. Part of these were fixed in rL304079.
      However, there was a more fundamental problem with these changes, namely that it
      bypasses the matadata value map, causing the cloned metadata to be a mix of metadata
      pointing to the new suprogram (where manual code was added to fix those up) and the
      old suprogram (where this was not the case). This mismatch could cause a number of
      different assertion failures in the DWARF emitter. Some of these are given at
      https://github.com/JuliaLang/julia/issues/22069, but some others have been observed
      as well. Attempt to rectify this by partially reverting the manual DI metadata fixup,
      and instead using the standard value map approach. To retain the desired semantics
      of not duplicating the compilation unit and inlined subprograms, explicitly freeze
      these in the value map.
      
      Reviewers: dblaikie, aprantl, GorNishanov, echristo
      
      Reviewed By: aprantl
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D33655
      
      llvm-svn: 304226
      945dc1d2
  30. May 18, 2017
    • Reid Kleckner's avatar
      [IR] De-virtualize ~Value to save a vptr · 96ab8726
      Reid Kleckner authored
      Summary:
      Implements PR889
      
      Removing the virtual table pointer from Value saves 1% of RSS when doing
      LTO of llc on Linux. The impact on time was positive, but too noisy to
      conclusively say that performance improved. Here is a link to the
      spreadsheet with the original data:
      
      https://docs.google.com/spreadsheets/d/1F4FHir0qYnV0MEp2sYYp_BuvnJgWlWPhWOwZ6LbW7W4/edit?usp=sharing
      
      This change makes it invalid to directly delete a Value, User, or
      Instruction pointer. Instead, such code can be rewritten to a null check
      and a call Value::deleteValue(). Value objects tend to have their
      lifetimes managed through iplist, so for the most part, this isn't a big
      deal.  However, there are some places where LLVM deletes values, and
      those places had to be migrated to deleteValue.  I have also created
      llvm::unique_value, which has a custom deleter, so it can be used in
      place of std::unique_ptr<Value>.
      
      I had to add the "DerivedUser" Deleter escape hatch for MemorySSA, which
      derives from User outside of lib/IR. Code in IR cannot include MemorySSA
      headers or call the MemoryAccess object destructors without introducing
      a circular dependency, so we need some level of indirection.
      Unfortunately, no class derived from User may have any virtual methods,
      because adding a virtual method would break User::getHungOffOperands(),
      which assumes that it can find the use list immediately prior to the
      User object. I've added a static_assert to the appropriate OperandTraits
      templates to help people avoid this trap.
      
      Reviewers: chandlerc, mehdi_amini, pete, dberlin, george.burgess.iv
      
      Reviewed By: chandlerc
      
      Subscribers: krytarowski, eraman, george.burgess.iv, mzolotukhin, Prazek, nlewycky, hans, inglorion, pcc, tejohnson, dberlin, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D31261
      
      llvm-svn: 303362
      96ab8726
  31. May 09, 2017
  32. May 08, 2017
Loading