[llvm] r288874 - [LVI] Remove used return value from markX functions

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 6 17:58:40 PST 2016


On Wed, Dec 7, 2016 at 2:14 AM Philip Reames via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: reames
> Date: Tue Dec  6 19:03:56 2016
> New Revision: 288874
>
> URL: http://llvm.org/viewvc/llvm-project?rev=288874&view=rev
> Log:
> [LVI] Remove used return value from markX functions
>
>
> Modified:
>     llvm/trunk/lib/Analysis/LazyValueInfo.cpp
>
> Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=288874&r1=288873&r2=288874&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
> +++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Tue Dec  6 19:03:56 2016
> @@ -141,37 +141,36 @@ public:
>    }
>
>  private:
> -  /// Return true if this is a change in status.
> -  bool markOverdefined() {
> +  void markOverdefined() {
>      if (isOverdefined())
> -      return false;
> +      return;
>      Tag = overdefined;
> -    return true;
>    }
>
> -  /// Return true if this is a change in status.
> -  bool markConstant(Constant *V) {
> +  void markConstant(Constant *V) {
>      assert(V && "Marking constant with NULL");
> -    if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
> -      return markConstantRange(ConstantRange(CI->getValue()));
> +    if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
> +      markConstantRange(ConstantRange(CI->getValue()));
> +      return;
> +    }
>      if (isa<UndefValue>(V))
> -      return false;
> +      return;
>
>      assert((!isConstant() || getConstant() == V) &&
>             "Marking constant with different value");
>      assert(isUndefined());
>      Tag = constant;
>      Val = V;
> -    return true;
>    }
>
> -  /// Return true if this is a change in status.
> -  bool markNotConstant(Constant *V) {
> +  void markNotConstant(Constant *V) {
>      assert(V && "Marking constant with NULL");
> -    if (ConstantInt *CI = dyn_cast<ConstantInt>(V))
> -      return markConstantRange(ConstantRange(CI->getValue()+1,
> CI->getValue()));
> +    if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
> +      markConstantRange(ConstantRange(CI->getValue()+1, CI->getValue()));
> +      return;
> +    }
>      if (isa<UndefValue>(V))
> -      return false;
> +      return;
>
>      assert((!isConstant() || getConstant() != V) &&
>             "Marking constant !constant with same value");
> @@ -180,27 +179,26 @@ private:
>      assert(isUndefined() || isConstant());
>      Tag = notconstant;
>      Val = V;
> -    return true;
>    }
>
> -  /// Return true if this is a change in status.
> -  bool markConstantRange(ConstantRange NewR) {
> +  void markConstantRange(ConstantRange NewR) {
>      if (isConstantRange()) {
>        if (NewR.isEmptySet())
> -        return markOverdefined();
> -
> -      bool changed = Range != NewR;
> -      Range = std::move(NewR);
> -      return changed;
> +        markOverdefined();
> +      else {
> +        bool changed = Range != NewR;
>

I now get:

../lib/Analysis/LazyValueInfo.cpp:189:14: warning: unused variable
'changed' [-Wunused-variable]
        bool changed = Range != NewR;
             ^


> +        Range = std::move(NewR);
> +      }
> +      return;
>      }
>
>      assert(isUndefined());
>      if (NewR.isEmptySet())
> -      return markOverdefined();
> -
> -    Tag = constantrange;
> -    Range = std::move(NewR);
> -    return true;
> +      markOverdefined();
> +    else {
> +      Tag = constantrange;
> +      Range = std::move(NewR);
> +    }
>    }
>
>  public:
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161207/6a57da2f/attachment.html>


More information about the llvm-commits mailing list