Allow constant to not have a block in shorten live ranges

If the invalue is currently added to the map of constants that we need
to add to blocks in the end, it can have a null block assigned (until
we fixup these in the end)

This will conservatively not make the instance get eligible for
canonicalization.

Bug: b/400746842
Change-Id: I052227840ee3a94790f5588b1b08645297c90a07
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/ConstantCanonicalizer.java b/src/main/java/com/android/tools/r8/ir/optimize/ConstantCanonicalizer.java
index cdc29c7..db5c9dc 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/ConstantCanonicalizer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/ConstantCanonicalizer.java
@@ -132,8 +132,9 @@
         // cant split the block and copy the catch handlers, since the canonicalized constant would
         // then not be defined on the exceptional edge.
         Value object = instanceGet.object();
-        if (!object.isDefinedByInstructionSatisfying(Instruction::instructionTypeCanThrow)
-            && object.getBlock().hasCatchHandlers()) {
+        if (!object.hasBlock()
+            || (!object.isDefinedByInstructionSatisfying(Instruction::instructionTypeCanThrow)
+                && object.getBlock().hasCatchHandlers())) {
           ineligibleInstanceGetInstructions.add(instanceGet);
         }
       }