[dart2js] Remove receiver-not-null strengthening

Adding the inference that, after `x.foo()`, `x` cannot be null used to
make sense, but with sound null safety means this is only applicable
when `x` is `dynamic`.

Removing the `knownType` update logic makes it easier to reason about
type propagation. There are very few regressions for removing this now
(huge app had half a dozen minor regressions, several other apps had
none).

If we decide to add something like this in the future, I think it
should be added as part of SsaTypeConversionInserter, and be extended
to add other post-conditions (e.g. the runtime helper `checkString(s)`
ensures `s` is a String).

Change-Id: I27a7fcbc13873867713c439c062ecf9bd71d644d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420504
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index 9fd434a..73b287d 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -4045,7 +4045,7 @@
 
 /// The [HTypeKnown] instruction marks a value with a refined type.
 class HTypeKnown extends HCheck {
-  AbstractValue knownType;
+  final AbstractValue knownType;
   final bool _isMovable;
 
   HTypeKnown.pinned(this.knownType, HInstruction input)
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index cae0ea8..09c1f5f 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -441,40 +441,6 @@
     AbstractValue receiverType = receiver.instructionType;
     node.updateReceiverType(abstractValueDomain, receiverType);
 
-    // Try to refine that the receiver is not null after this call by inserting
-    // a refinement node (HTypeKnown).
-    var selector = node.selector;
-    if (!selector.isMaybeClosureCall && !selector.appliesToNullWithoutThrow()) {
-      var next = node.next;
-      if (next is HTypeKnown && next.checkedInput == receiver) {
-        // On a previous pass or iteration we already refined [receiver] by
-        // inserting a [HTypeKnown] instruction. That replaced several dominated
-        // uses with the refinement. We update the type of the [HTypeKnown]
-        // instruction because it may have been refined with a correct type at
-        // the time, but incorrect now.
-        AbstractValue newType = abstractValueDomain.excludeNull(receiverType);
-        if (next.instructionType != newType) {
-          next.knownType = next.instructionType = newType;
-          addDependentInstructionsToWorkList(next);
-        }
-      } else if (abstractValueDomain.isNull(receiverType).isPotentiallyTrue) {
-        DominatedUses uses = DominatedUses.of(
-          receiver,
-          node,
-          excludeDominator: true,
-        );
-        if (uses.isNotEmpty) {
-          // Insert a refinement node after the call and update all users
-          // dominated by the call to use that node instead of [receiver].
-          AbstractValue newType = abstractValueDomain.excludeNull(receiverType);
-          HTypeKnown converted = HTypeKnown.witnessed(newType, receiver, node);
-          node.block!.addBefore(node.next, converted);
-          uses.replaceWith(converted);
-          addDependentInstructionsToWorkList(converted);
-        }
-      }
-    }
-
     var result = node.specializer.computeTypeFromInputTypes(
       node,
       results,