[llvm-commits] [llvm] r161258 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp

Lang Hames lhames at gmail.com
Mon Aug 6 13:20:27 PDT 2012


This is great!

- Lang.

On Fri, Aug 3, 2012 at 1:59 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:

> Author: stoklund
> Date: Fri Aug  3 15:59:32 2012
> New Revision: 161258
>
> URL: http://llvm.org/viewvc/llvm-project?rev=161258&view=rev
> Log:
> Completely eliminate VNInfo flags.
>
> The 'unused' state of a value number can be represented as an invalid
> def SlotIndex. This also exposed code that shouldn't have been looking
> at unused value VNInfos.
>
> Modified:
>     llvm/trunk/include/llvm/CodeGen/LiveInterval.h
>     llvm/trunk/lib/CodeGen/LiveInterval.cpp
>     llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=161258&r1=161257&r2=161258&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Fri Aug  3 15:59:32 2012
> @@ -40,13 +40,6 @@
>    /// definition and use points.
>    ///
>    class VNInfo {
> -  private:
> -    enum {
> -      IS_UNUSED       = 1
> -    };
> -
> -    unsigned char flags;
> -
>    public:
>      typedef BumpPtrAllocator Allocator;
>
> @@ -58,29 +51,19 @@
>
>      /// VNInfo constructor.
>      VNInfo(unsigned i, SlotIndex d)
> -      : flags(0), id(i), def(d)
> +      : id(i), def(d)
>      { }
>
>      /// VNInfo construtor, copies values from orig, except for the value
> number.
>      VNInfo(unsigned i, const VNInfo &orig)
> -      : flags(orig.flags), id(i), def(orig.def)
> +      : id(i), def(orig.def)
>      { }
>
>      /// Copy from the parameter into this VNInfo.
>      void copyFrom(VNInfo &src) {
> -      flags = src.flags;
>        def = src.def;
>      }
>
> -    /// Used for copying value number info.
> -    unsigned getFlags() const { return flags; }
> -    void setFlags(unsigned flags) { this->flags = flags; }
> -
> -    /// Merge flags from another VNInfo
> -    void mergeFlags(const VNInfo *VNI) {
> -      flags = (flags | VNI->flags) & ~IS_UNUSED;
> -    }
> -
>      /// Returns true if this value is defined by a PHI instruction (or
> was,
>      /// PHI instrucions may have been eliminated).
>      /// PHI-defs begin at a block boundary, all other defs begin at
> register or
> @@ -88,14 +71,10 @@
>      bool isPHIDef() const { return def.isBlock(); }
>
>      /// Returns true if this value is unused.
> -    bool isUnused() const { return flags & IS_UNUSED; }
> -    /// Set the "is unused" flag on this value.
> -    void setIsUnused(bool unused) {
> -      if (unused)
> -        flags |= IS_UNUSED;
> -      else
> -        flags &= ~IS_UNUSED;
> -    }
> +    bool isUnused() const { return !def.isValid(); }
> +
> +    /// Mark this value as unused.
> +    void markUnused() { def = SlotIndex(); }
>    };
>
>    /// LiveRange structure - This represents a simple register range in the
>
> Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=161258&r1=161257&r2=161258&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Fri Aug  3 15:59:32 2012
> @@ -160,7 +160,7 @@
>        valnos.pop_back();
>      } while (!valnos.empty() && valnos.back()->isUnused());
>    } else {
> -    ValNo->setIsUnused(true);
> +    ValNo->markUnused();
>    }
>  }
>
> @@ -667,9 +667,6 @@
>      }
>    }
>
> -  // Merge the relevant flags.
> -  V2->mergeFlags(V1);
> -
>    // Now that V1 is dead, remove it.
>    markValNoForDeletion(V1);
>
>
> Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=161258&r1=161257&r2=161258&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Aug  3 15:59:32
> 2012
> @@ -706,7 +706,7 @@
>        continue;
>      if (VNI->isPHIDef()) {
>        // This is a dead PHI. Remove it.
> -      VNI->setIsUnused(true);
> +      VNI->markUnused();
>        NewLI.removeRange(*LII);
>        DEBUG(dbgs() << "Dead PHI at " << VNI->def << " may separate
> interval\n");
>        CanSeparate = true;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120806/c44ba658/attachment.html>


More information about the llvm-commits mailing list