[llvm] [SimplifyCFG] Handle that first matched eq cond in if chain can be Extra condition. (PR #154007)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 17 02:41:04 PDT 2025
================
@@ -564,9 +564,19 @@ struct ConstantComparesGatherer {
/// Number of comparisons matched in the and/or chain
unsigned UsedICmps = 0;
+ // Used to check if the first matched CompValue shall be the Extra check.
+ bool IgnoreFirstMatch = false;
+
/// Construct and compute the result for the comparison instruction Cond
ConstantComparesGatherer(Instruction *Cond, const DataLayout &DL) : DL(DL) {
gather(Cond);
+ if (CompValue)
+ return;
+ Extra = nullptr;
+ Vals.clear();
+ UsedICmps = 0;
+ IgnoreFirstMatch = true;
+ gather(Cond);
----------------
andjo403 wrote:
tried to make this in the loop in gather but was complicated to get it right this was the simplest solution that I was able to find
https://github.com/llvm/llvm-project/pull/154007
More information about the llvm-commits
mailing list