[llvm-commits] [llvm] r161803 - in /llvm/trunk: include/llvm/Support/ValueHandle.h lib/Transforms/Utils/SSAUpdater.cpp

Eli Friedman eli.friedman at gmail.com
Mon Aug 13 17:44:14 PDT 2012


On Mon, Aug 13, 2012 at 4:06 PM, Nadav Rotem <nrotem at apple.com> wrote:
> Author: nadav
> Date: Mon Aug 13 18:06:54 2012
> New Revision: 161803
>
> URL: http://llvm.org/viewvc/llvm-project?rev=161803&view=rev
> Log:
> LICM uses AliasSet information to hoist and sink instructions. However, other passes, such as LoopRotate
> may invalidate its AliasSet because SSAUpdater does not update the AliasSet properly.
> This patch teaches SSAUpdater to notify AliasSet that it made changes.
> The testcase in PR12901 is too big to be useful and I could not reduce it to a normal size.
>
> rdar://11872059 PR12901
>
>
> Modified:
>     llvm/trunk/include/llvm/Support/ValueHandle.h
>     llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp
>
> Modified: llvm/trunk/include/llvm/Support/ValueHandle.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ValueHandle.h?rev=161803&r1=161802&r2=161803&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/ValueHandle.h (original)
> +++ llvm/trunk/include/llvm/Support/ValueHandle.h Mon Aug 13 18:06:54 2012
> @@ -110,11 +110,12 @@
>             V != DenseMapInfo<Value *>::getTombstoneKey();
>    }
>
> -private:
> +public:
>    // Callbacks made from Value.
>    static void ValueIsDeleted(Value *V);
>    static void ValueIsRAUWd(Value *Old, Value *New);
>
> +private:
>    // Internal implementation details.
>    ValueHandleBase **getPrevPtr() const { return PrevPair.getPointer(); }
>    HandleBaseKind getKind() const { return PrevPair.getInt(); }
>
> Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp?rev=161803&r1=161802&r2=161803&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/SSAUpdater.cpp Mon Aug 13 18:06:54 2012
> @@ -214,6 +214,11 @@
>    else
>      V = GetValueInMiddleOfBlock(User->getParent());
>
> +  // Notify that users of the existing value that it is being replaced.
> +  Value *OldVal = U.get();
> +  if (OldVal != V && OldVal->hasValueHandle())
> +    ValueHandleBase::ValueIsRAUWd(OldVal, V);

Calling a method named ValueIsRAUWd here seems a bit unintuitive:
you're not replacing all the uses, just one of them.

-Eli



More information about the llvm-commits mailing list