Skip to content
  1. Sep 05, 2015
  2. Sep 04, 2015
    • Hal Finkel's avatar
      Don't crash on a self-alias declaration · 0e2b975e
      Hal Finkel authored
      We were crashing in CodeGen given input like this:
      
        int self_alias(void) __attribute__((weak, alias("self_alias")));
      
      such a self-alias is invalid, but instead of diagnosing the situation, we'd
      proceed to produce IR for both the function declaration and the alias. Because
      we already had a function named 'self_alias', the alias could not be named the
      same thing, and so LLVM would pick a different name ('self_alias1' for example)
      for that value. When we later called CodeGenModule::checkAliases, we'd look up
      the IR value corresponding to the alias name, find the function declaration
      instead, and then assert in a cast to llvm::GlobalAlias. The easiest way to prevent
      this is simply to avoid creating the wrongly-named alias value in the first
      place and issue the diagnostic there (instead of in checkAliases). We detect a
      related cycle case in CodeGenModule::EmitAliasDefinition already, so this just
      adds a second such check.
      
      Even though the other test cases for this 'alias definition is part of a cycle'
      diagnostic are in test/Sema/attr-alias-elf.c, I've added a separate regression
      test for this case. This is because I can't add this check to
      test/Sema/attr-alias-elf.c without disturbing the other test cases in that
      file. In order to avoid construction of the bad IR values, this diagnostic
      is emitted from within CodeGenModule::EmitAliasDefinition (and the relevant
      declaration is not added to the Aliases vector). The other cycle checks are
      done within the CodeGenModule::checkAliases function based on the Aliases
      vector, called from CodeGenModule::Release.  However, if there have been errors
      earlier, HandleTranslationUnit does not call Release, and so checkAliases is
      never called, and so none of the other diagnostics would be produced.
      
      Fixes PR23509.
      
      llvm-svn: 246882
      0e2b975e
    • Richard Smith's avatar
      Fix crash on invalid if we can't find a suitable PCH file in a specified · 81c7248c
      Richard Smith authored
      directory, and our frontend action cares whether the frontend setup actually
      succeeded.
      
      llvm-svn: 246881
      81c7248c
    • Reid Kleckner's avatar
      Don't use unreachable as a placeholder, it confuses EmitBlock · 5ee4b9a1
      Reid Kleckner authored
      This fixes an issue raised in D12412, where we generated invalid IR.
      
      Thanks to Vedant Kumar for coming up with the initial work around.
      
      Differential Revision: http://reviews.llvm.org/D12412
      
      llvm-svn: 246880
      5ee4b9a1
    • Angel Garcia Gomez's avatar
      Avoid repeated replacements on loop-convert check. · bd0ec69e
      Angel Garcia Gomez authored
      Summary: The InitListExpr subtree is visited twice, this caused the check to do multiple replacements. Added a set to avoid it.
      
      Reviewers: klimek, alexfh
      
      Subscribers: cfe-commits, alexfh
      
      Differential Revision: http://reviews.llvm.org/D12631
      
      llvm-svn: 246879
      bd0ec69e
    • Rui Ueyama's avatar
      COFF: Implement a better algorithm for ICF. · ef907ec8
      Rui Ueyama authored
      Identical COMDAT Folding is a feature to merge COMDAT sections
      by contents. Two sections are considered the same if their contents,
      relocations, attributes, etc, are all the same.
      
      An interesting fact is that MSVC linker takes "iterations" parameter
      for ICF because the algorithm they are using is iterative. Merging
      two sections could make more sections to be mergeable because
      different relocations could now point to the same section. ICF is
      repeated until we get a convergence (until no section can be merged).
      This algorithm is not fast. Usually it needs three iterations until a
      convergence is obtained.
      
      In the new algorithm implemented in this patch, we consider sections
      and relocations as a directed acyclic graph, and we try to merge
      sections whose outdegree is zero. Sections with outdegree zero are then
      removed from the graph, which makes  other sections to have outdegree
      zero. We repeat that until all sections are processed. In this
      algorithm, we don't iterate over the same sections many times.
      
      There's an apparent issue in the algorithm -- the section graph is
      not guaranteed to be acyclic. It's actually pretty often cyclic.
      So this algorithm cannot eliminate all possible duplicates.
      That's OK for now because the previous algorithm was not able to
      eliminate cycles too. I'll address the issue in a follow-up patch.
      
      llvm-svn: 246878
      ef907ec8
    • George Burgess IV's avatar
      Increase accuracy of __builtin_object_size. · 3a03fabd
      George Burgess IV authored
      Improvements:
      
      - For all types, we would give up in a case such as:
          __builtin_object_size((char*)&foo, N);
        even if we could provide an answer to
          __builtin_object_size(&foo, N);
        We now provide the same answer for both of the above examples in all
        cases.
      
      - For type=1|3, we now support subobjects with unknown bases, as long
        as the designator is valid.
      
      Thanks to Richard Smith for the review + design planning.
      
      Review: http://reviews.llvm.org/D12169
      llvm-svn: 246877
      3a03fabd
Loading