@@ -608,11 +608,8 @@ class RegionStoreManager : public StoreManager {
608608 return getBinding (getRegionBindings (S), L, T);
609609 }
610610
611- // / Returns the value of the default binding of region \p BaseR
612- // / if and only if that is the unique binding in the cluster of \p BaseR.
613- // / \p BaseR must be a base region.
614- std::optional<SVal> getUniqueDefaultBinding (Store S,
615- const MemRegion *BaseR) const ;
611+ std::optional<SVal>
612+ getUniqueDefaultBinding (nonloc::LazyCompoundVal LCV) const ;
616613
617614 std::optional<SVal> getDefaultBinding (Store S, const MemRegion *R) override {
618615 RegionBindingsRef B = getRegionBindings (S);
@@ -2612,10 +2609,14 @@ RegionBindingsRef RegionStoreManager::bindVector(RegionBindingsConstRef B,
26122609}
26132610
26142611std::optional<SVal>
2615- RegionStoreManager::getUniqueDefaultBinding (Store S,
2616- const MemRegion *BaseR) const {
2617- assert (BaseR == BaseR->getBaseRegion () && " Expecting a base region" );
2618- const auto *Cluster = getRegionBindings (S).lookup (BaseR);
2612+ RegionStoreManager::getUniqueDefaultBinding (nonloc::LazyCompoundVal LCV) const {
2613+ const MemRegion *BaseR = LCV.getRegion ();
2614+
2615+ // We only handle base regions.
2616+ if (BaseR != BaseR->getBaseRegion ())
2617+ return std::nullopt ;
2618+
2619+ const auto *Cluster = getRegionBindings (LCV.getStore ()).lookup (BaseR);
26192620 if (!Cluster || !llvm::hasSingleElement (*Cluster))
26202621 return std::nullopt ;
26212622
@@ -2640,11 +2641,8 @@ std::optional<RegionBindingsRef> RegionStoreManager::tryBindSmallStruct(
26402641 // Direct [ 0..31]: Derived{Conj{}, w.width}
26412642 // Direct [32..63]: Derived{Conj{}, w.height}
26422643 // Instead, we should just bind that Conjured value instead.
2643- if (LCV.getRegion ()->getBaseRegion () == LCV.getRegion ()) {
2644- if (auto Val = getUniqueDefaultBinding (LCV.getStore (), LCV.getRegion ())) {
2645- return B.addBinding (BindingKey::Make (R, BindingKey::Default),
2646- Val.value ());
2647- }
2644+ if (auto Val = getUniqueDefaultBinding (LCV)) {
2645+ return B.addBinding (BindingKey::Make (R, BindingKey::Default), Val.value ());
26482646 }
26492647
26502648 FieldVector Fields;
0 commit comments