Skip to content
  1. Oct 12, 2012
    • NAKAMURA Takumi's avatar
      2d1bd7cc
    • Nick Lewycky's avatar
      Shuffle the virtual destructor down to the base. This should actually pacify · 6522c717
      Nick Lewycky authored
      -Wnon-virtual-dtor for real.
      
      llvm-svn: 165787
      6522c717
    • Nick Lewycky's avatar
      Give this class full of virtual functions a virtual destructor. Classes love · 758077c2
      Nick Lewycky authored
      virtual destructors.
      
      llvm-svn: 165786
      758077c2
    • Eric Christopher's avatar
      Indenting. · ca2ff70e
      Eric Christopher authored
      llvm-svn: 165785
      ca2ff70e
    • Sebastian Pop's avatar
      fix warning · e9623261
      Sebastian Pop authored
      DependenceAnalysis.cpp:1164:32: warning: implicit truncation from 'int' to bitfield changes value from -5 to 3
            [-Wconstant-conversion]
          Result.DV[Level].Direction &= ~Dependence::DVEntry::GT;
                                     ^  ~~~~~~~~~~~~~~~~~~~~~~~~
      
      Patch from Preston Briggs <preston.briggs@gmail.com>.
      
      llvm-svn: 165784
      e9623261
    • Reed Kotler's avatar
      Div, Rem int/unsigned int · cf11c59e
      Reed Kotler authored
      llvm-svn: 165783
      cf11c59e
    • Sean Silva's avatar
      docs: Update example to conform to coding standards. · 3b942abe
      Sean Silva authored
      llvm-svn: 165782
      3b942abe
    • Bill Wendling's avatar
      Mark function as 'used' so that LTO doesn't try to get rid of it. · 35ac231d
      Bill Wendling authored
      llvm-svn: 165781
      35ac231d
    • NAKAMURA Takumi's avatar
    • Sean Silva's avatar
      docs: Minor clean up of Phabricator documentation. · b39f47b0
      Sean Silva authored
      llvm-svn: 165779
      b39f47b0
    • Evan Cheng's avatar
      Legalizer optimize a pair of div / mod to a call to divrem libcall if they are · 21c4adcd
      Evan Cheng authored
      not legal. However, it should use a div instruction + mul + sub if divide is
      legal. The rem legalization code was missing a check and incorrectly uses a
      divrem libcall even when div is legal.
      
      rdar://12481395
      
      llvm-svn: 165778
      21c4adcd
    • Bill Wendling's avatar
      Mark function as 'used' so that LTO doesn't try to get rid of it. · 408668a8
      Bill Wendling authored
      llvm-svn: 165777
      408668a8
    • Bill Wendling's avatar
      We need this symbol after an LTO build. · c2c6411f
      Bill Wendling authored
      llvm-svn: 165776
      c2c6411f
    • Sean Silva's avatar
      docs: Add SphinxQuickstartTemplate.rst. · d91ff4c9
      Sean Silva authored
      The intent of this document is to be the go-to document for anybody who
      wants to write new documentation, but isn't familiar with Sphinx.
      
      llvm-svn: 165775
      d91ff4c9
    • Sean Silva's avatar
      docs: Improve HowToSetUpLLVMStyleRTTI. · d7802ad8
      Sean Silva authored
      * Fix confusing explanation regarding abstract classes.
      
      * Clarify auto-upcasting and why `Shape` doesn't need a `classof()`.
      
      * Add section `Rules of Thumb` with some quick summary tips.
      
      llvm-svn: 165768
      d7802ad8
    • Sean Silva's avatar
      Remove unnecessary classof()'s · 506a1c5a
      Sean Silva authored
      isa<> et al. automatically infer when the cast is an upcast (including a
      self-cast), so these are no longer necessary.
      
      llvm-svn: 165767
      506a1c5a
    • Sean Silva's avatar
      docs: Update HowToSetUpLLVMStyleRTTI. · d73b2818
      Sean Silva authored
      Recent changes to isa<>/dyn_cast<> have made unnecessary those classof()
      of the form:
      
          static bool classof(const Foo *) { return true; }
      
      Accordingly, remove mention of such classof() from the documentation.
      
      llvm-svn: 165766
      d73b2818
    • Sean Silva's avatar
      Casting.h: Automatically handle isa<Base>(Derived). · 35dd8779
      Sean Silva authored
      Additionally, all such cases are handled with no dynamic check.
      
      All `classof()` of the form
      
          class Foo {
            [...]
            static bool classof(const Bar *) { return true; }
            [...]
          }
      
      where Foo is an ancestor of Bar are no longer necessary.
      Don't write them!
      
      Note: The exact test is `is_base_of<Foo, Bar>`, which is non-strict, so
      that Foo is considered an ancestor of itself.
      
      This leads to the following rule of thumb for LLVM-style RTTI:
      
          The argument type of `classof()` should be a strict ancestor.
      
      For more information about implementing LLVM-style RTTI, see
      docs/HowToSetUpLLVMStyleRTTI.rst
      
      llvm-svn: 165765
      35dd8779
    • Sean Silva's avatar
      Remove buggy classof(). · bead14e9
      Sean Silva authored
      This classof() is effectively saying that a MachineCodeEmitter "is-a"
      JITEmitter, but JITEmitter is in fact a descendant of
      MachineCodeEmitter, so this is not semantically correct. Consequently,
      none of the assertions that rely on these classof() actualy check
      anything.
      
      Remove the RTTI (which didn't actually check anything) and use
      static_cast<> instead.
      
      Post-Mortem Bug Analysis
      ========================
      
      Cause of the bug
      ----------------
      
      r55022 appears to be the source of the classof() and assertions removed
      by this commit. It aimed at removing some dynamic_cast<> that were
      solely in the assertions. A typical diff hunk from that commit looked
      like:
      
        -  assert(dynamic_cast<JITEmitter*>(MCE) && "Unexpected MCE?");
        -  JITEmitter *JE = static_cast<JITEmitter*>(getCodeEmitter());
        +  assert(isa<JITEmitter>(MCE) && "Unexpected MCE?");
        +  JITEmitter *JE = cast<JITEmitter>(getCodeEmitter());
      
      Hence, the source of the bug then seems to be an attempt to replace
      dynamic_cast<> with LLVM-style RTTI without properly setting up the
      class hierarchy for LLVM-style RTTI. The bug therefore appears to be
      simply a "thinko".
      
      What initially indicated the presence of the bug
      ------------------------------------------------
      
      After implementing automatic upcasting for isa<>, classof() functions of
      the form
      
        static bool classof(const Foo *) { return true; }
      
      were removed, since they only serve the purpose of optimizing
      statically-OK upcasts. A subsequent recompilation triggered a build
      failure on the isa<> tests within the removed asserts, since the
      automatic upcasting (correctly) failed to substitute this classof().
      
      Key to pinning down the root cause of the bug
      ---------------------------------------------
      
      After being alerted to the presence of the bug, some thought about the
      semantics which were being asserted by the buggy classof() revealed that
      it was incorrect.
      
      How the bug could have been prevented
      -------------------------------------
      
      This bug could have been prevented by better documentation for how to
      set up LLVM-style RTTI. This should be solved by the recently added
      documentation HowToSetUpLLVMStyleRTTI. However, this bug suggests that
      the documentation should clearly explain the contract that classof()
      must fulfill. The HowToSetUpLLVMStyleRTTI already explains this
      contract, but it is a little tucked away. A future patch will expand
      that explanation and make it more prominent.
      
      There does not appear to be a simple way to have the compiler prevent
      this bug, since fundamentally it boiled down to a spurious classof()
      where the programmer made an erroneous statement about the conversion.
      This suggests that perhaps the interface to LLVM-style RTTI of classof()
      is not the best. There is already some evidence for this, since in a
      number of places Clang has classof() forward to classofKind(Kind K)
      which evaluates the cast in terms of just the Kind. This could probably
      be generalized to simply a `static const Kind MyKind;` field in leaf
      classes and `static const Kind firstMyKind, lastMyKind;` for non-leaf
      classes, and have the rest of the work be done inside Casting.h,
      assuming that the Kind enum is laid out in a preorder traversal of the
      inheritance tree.
      
      llvm-svn: 165764
      bead14e9
    • Manman Ren's avatar
      PGO: create metadata for switch only if it has more than one targets. · 97c18762
      Manman Ren authored
      When all cases of a switch statement are dead, the weights vector only has one
      element, and we will get an ssertion failure when calling createBranchWeights.
      
      llvm-svn: 165759
      97c18762
    • Chad Rosier's avatar
      Remove extra semicolon. · 959c71a6
      Chad Rosier authored
      llvm-svn: 165758
      959c71a6
    • Chad Rosier's avatar
      Remove extra semicolons. · 2b189a5b
      Chad Rosier authored
      llvm-svn: 165757
      2b189a5b
  2. Oct 11, 2012
Loading