8079343: Crash in PhaseIdealLoop with "assert(!had_error) failed: bad dominance"
C2 should not try to vectorize loops with loop variant vector base address.
Reviewed-by: kvn
diff --git a/hotspot/src/share/vm/opto/superword.cpp b/hotspot/src/share/vm/opto/superword.cpp
index 7047b71..adc7885 100644
--- a/hotspot/src/share/vm/opto/superword.cpp
+++ b/hotspot/src/share/vm/opto/superword.cpp
@@ -2249,6 +2249,11 @@
}
// Match AddP(base, AddP(ptr, k*iv [+ invariant]), constant)
Node* base = adr->in(AddPNode::Base);
+ // The base address should be loop invariant
+ if (!invariant(base)) {
+ assert(!valid(), "base address is loop variant");
+ return;
+ }
//unsafe reference could not be aligned appropriately without runtime checking
if (base == NULL || base->bottom_type() == Type::TOP) {
assert(!valid(), "unsafe access");