AssumptionCache can be null in SimplifyCFGOptions. However, FoldCondBranchOnPHI() was not properly handling that when passing a null AssumptionCache to simplifyCFG.
LGTM with a few small suggestions. Please wait a bit with committing in case there are additional comments.
While you are at it, it might be worth simplifying the condition to something like if (AC && match(N, m_Intrinsic<IntrinsicInst::assume>())
might be worth stating that this is just to get a pointer to %test.bb. You could also just check the BB name, which is slightly more direct. Also, it would be good to assert that we found TestBB.
nit: you could just use EXPECT_TRUE directly, I do not think the variable adds much.