@@ -173,7 +173,7 @@ template <typename L> struct AllTop final {
173173 [[nodiscard]] static EdgeFunction<l_t >
174174 compose (EdgeFunctionRef<AllTop> This,
175175 const EdgeFunction<l_t > &SecondFunction) {
176- return llvm::isa<EdgeIdentity< l_t >>( SecondFunction) ? This : SecondFunction ;
176+ return SecondFunction. isConstant ( ) ? SecondFunction : This ;
177177 }
178178
179179 [[nodiscard]] static EdgeFunction<l_t >
@@ -211,13 +211,16 @@ defaultComposeOrNull(const EdgeFunction<L> &This,
211211 if (llvm::isa<EdgeIdentity<L>>(SecondFunction)) {
212212 return This;
213213 }
214- if (SecondFunction.isConstant () || llvm::isa<AllTop<L>>(This) ||
215- llvm::isa<EdgeIdentity<L>>(This)) {
214+ if (SecondFunction.isConstant () || llvm::isa<EdgeIdentity<L>>(This)) {
216215 return SecondFunction;
217216 }
218- if (llvm::isa<AllBottom <L>>(This)) {
217+ if (llvm::isa<AllTop <L>>(This)) {
219218 return This;
220219 }
220+ if (auto BotEF = This.template asRef <AllBottom<L>>()) {
221+ return AllBottom<L>::compose (*BotEF, SecondFunction);
222+ }
223+
221224 return nullptr ;
222225}
223226
@@ -471,12 +474,10 @@ ConstantEdgeFunction<L>::compose(EdgeFunctionRef<ConcreteEF> This,
471474
472475 if constexpr (AreEqualityComparable<decltype (JLattice::top ()), L>) {
473476 if (JLattice::top () == ConstVal) {
474- // / TODO: Can this ever happen?
475477 return AllTop<L>{};
476478 }
477479 } else {
478480 if (L (JLattice::top ()) == ConstVal) {
479- // / TODO: Can this ever happen?
480481 return AllTop<L>{};
481482 }
482483 }
@@ -505,7 +506,7 @@ ConstantEdgeFunction<L>::join(EdgeFunctionRef<ConcreteEF> This,
505506 return OtherFunction.joinWith (This);
506507 }
507508
508- auto OtherVal = OtherFunction.computeTarget (JLattice::top ());
509+ auto OtherVal = OtherFunction.computeTarget (JLattice::bottom ());
509510 auto JoinedVal = JLattice::join (This->Value , OtherVal);
510511
511512 if constexpr (AreEqualityComparable<decltype (JLattice::bottom ()), l_t >) {
0 commit comments