[llvm] c5c967c - [ValueLattice] Remove unnecessary ConstVal nulling (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 13:38:57 PDT 2020


Author: Nikita Popov
Date: 2020-04-18T22:36:38+02:00
New Revision: c5c967c6a252fe4d50b558775a01a86bdc4d95a0

URL: https://github.com/llvm/llvm-project/commit/c5c967c6a252fe4d50b558775a01a86bdc4d95a0
DIFF: https://github.com/llvm/llvm-project/commit/c5c967c6a252fe4d50b558775a01a86bdc4d95a0.diff

LOG: [ValueLattice] Remove unnecessary ConstVal nulling (NFC)

ConstVal is not an owned pointer, so setting it to nullptr is not
actually doing anything. If we switch to a state that does not use
ConstVal, the value does not matter.

Split out from D78425.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/ValueLattice.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/ValueLattice.h b/llvm/include/llvm/Analysis/ValueLattice.h
index 51ddd103fcfb..d970fbfbb403 100644
--- a/llvm/include/llvm/Analysis/ValueLattice.h
+++ b/llvm/include/llvm/Analysis/ValueLattice.h
@@ -122,12 +122,6 @@ class ValueLatticeElement {
     if (isConstantRange() && !Other.isConstantRange())
       Range.~ConstantRange();
 
-    // If we change the state of this from a valid ConstVal to another a state
-    // without a valid ConstVal, zero the pointer.
-    if ((isConstant() || isNotConstant()) && !Other.isConstant() &&
-        !Other.isNotConstant())
-      ConstVal = nullptr;
-
     switch (Other.Tag) {
     case constantrange:
     case constantrange_including_undef:
@@ -229,8 +223,6 @@ class ValueLatticeElement {
   bool markOverdefined() {
     if (isOverdefined())
       return false;
-    if (isConstant() || isNotConstant())
-      ConstVal = nullptr;
     if (isConstantRange())
       Range.~ConstantRange();
     Tag = overdefined;


        


More information about the llvm-commits mailing list