Skip to content
  1. Jul 11, 2018
  2. Jul 10, 2018
    • Evgeniy Stepanov's avatar
      Revert r336653 "[VPlan] Add VPlanTestBase.h with helper class to build VPlan for tests." · 3306a498
      Evgeniy Stepanov authored
      Memory leaks in tests.
      http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/6289/steps/check-llvm%20asan/logs/stdio
      
      Direct leak of 192 byte(s) in 1 object(s) allocated from:
          #0 0x554ea8 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:106
          #1 0x56cef1 in llvm::VPlanTestBase::doAnalysis(llvm::Function&) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h:53:14
          #2 0x56bec4 in llvm::VPlanTestBase::buildHCFG(llvm::BasicBlock*) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/Transforms/Vectorize/VPlanTestBase.h:57:3
          #3 0x571f1e in llvm::(anonymous namespace)::VPlanHCFGTest_testVPInstructionToVPRecipesInner_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/Transforms/Vectorize/VPlanHCFGTest.cpp:119:15
          #4 0xed2291 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
          #5 0xed44c8 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
          #6 0xed5890 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
          #7 0xef3634 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
          #8 0xef27e0 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
          #9 0xebbc23 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
          #10 0xebbc23 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:51
          #11 0x7f65569592e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
      
      and more.
      
      llvm-svn: 336718
      3306a498
    • Florian Hahn's avatar
      [VPlan] Add VPlanTestBase.h with helper class to build VPlan for tests. · 8263975c
      Florian Hahn authored
      Reviewers: dcaballe, hsaito, rengolin
      
      Reviewed By: dcaballe
      
      Differential Revision: https://reviews.llvm.org/D49032
      
      llvm-svn: 336653
      8263975c
  3. Jul 09, 2018
    • Diego Caballero's avatar
      [VPlan][LV] Introduce condition bit in VPBlockBase · d0953014
      Diego Caballero authored
      This patch introduces a VPValue in VPBlockBase to represent the condition
      bit that is used as successor selector when a block has multiple successors.
      This information wasn't necessary until now, when we are about to introduce
      outer loop vectorization support in VPlan code gen.
      
      Reviewers: fhahn, rengolin, mkuper, hfinkel, mssimpso
      
      Reviewed By: fhahn
      
      Differential Revision: https://reviews.llvm.org/D48814
      
      llvm-svn: 336554
      d0953014
  4. Jul 06, 2018
    • Vedant Kumar's avatar
      [Local] replaceAllDbgUsesWith: Update debug values before RAUW · 6379a622
      Vedant Kumar authored
      The replaceAllDbgUsesWith utility helps passes preserve debug info when
      replacing one value with another.
      
      This improves upon the existing insertReplacementDbgValues API by:
      
      - Updating debug intrinsics in-place, while preventing use-before-def of
        the replacement value.
      - Falling back to salvageDebugInfo when a replacement can't be made.
      - Moving the responsibiliy for rewriting llvm.dbg.* DIExpressions into
        common utility code.
      
      Along with the API change, this teaches replaceAllDbgUsesWith how to
      create DIExpressions for three basic integer and pointer conversions:
      
      - The no-op conversion. Applies when the values have the same width, or
        have bit-for-bit compatible pointer representations.
      - Truncation. Applies when the new value is wider than the old one.
      - Zero/sign extension. Applies when the new value is narrower than the
        old one.
      
      Testing:
      
      - check-llvm, check-clang, a stage2 `-g -O3` build of clang,
        regression/unit testing.
      - This resolves a number of mis-sized dbg.value diagnostics from
        Debugify.
      
      Differential Revision: https://reviews.llvm.org/D48676
      
      llvm-svn: 336451
      6379a622
  5. Jun 19, 2018
  6. Jun 18, 2018
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. Mar 06, 2018
  13. 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
  14. Feb 28, 2018
  15. Feb 14, 2018
  16. Jan 31, 2018
  17. Jan 17, 2018
  18. Dec 08, 2017
  19. Nov 18, 2017
  20. Nov 16, 2017
  21. Oct 26, 2017
  22. Oct 25, 2017
  23. 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
  24. 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
  25. Sep 22, 2017
  26. 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
  27. 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
  28. 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
  29. Jul 28, 2017
  30. 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
Loading