diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1059,8 +1059,8 @@ if (DT->dominates(cast(OtherAccess), cast(U))) OtherAccess = U; else - assert(DT->dominates(cast(U), - cast(OtherAccess))); + assert(U == OtherAccess || DT->dominates(cast(U), + cast(OtherAccess))); } else OtherAccess = U; }