[PATCH] D117184: Fix failing assertion in SimplifyCFG.cpp as icmp gep fold to constant expression

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 18 00:10:45 PST 2022


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5808
                                                 ValuePair.second, CmpOp1, true);
-    if (!CaseConst || CaseConst == DefaultConst || isa<UndefValue>(CaseConst))
+    if (!CaseConst || CaseConst == DefaultConst || isa<UndefValue>(CaseConst) ||
+        (CaseConst != TrueConst && CaseConst != FalseConst))
----------------
You can drop the isa<UndefValue> check here, because it is already covered by the other condition (undef is neither true nor false).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117184/new/

https://reviews.llvm.org/D117184



More information about the llvm-commits mailing list