@@ -15730,6 +15730,8 @@ static bool compareCmp(Value *V, Value *V2, TargetLibraryInfo &TLI,
15730
15730
assert(isValidElementType(V->getType()) &&
15731
15731
isValidElementType(V2->getType()) &&
15732
15732
"Expected valid element types only.");
15733
+ if (V == V2)
15734
+ return IsCompatibility;
15733
15735
auto *CI1 = cast<CmpInst>(V);
15734
15736
auto *CI2 = cast<CmpInst>(V2);
15735
15737
if (CI1->getOperand(0)->getType()->getTypeID() <
@@ -15754,6 +15756,8 @@ static bool compareCmp(Value *V, Value *V2, TargetLibraryInfo &TLI,
15754
15756
for (int I = 0, E = CI1->getNumOperands(); I < E; ++I) {
15755
15757
auto *Op1 = CI1->getOperand(CI1Preds ? I : E - I - 1);
15756
15758
auto *Op2 = CI2->getOperand(CI2Preds ? I : E - I - 1);
15759
+ if (Op1 == Op2)
15760
+ continue;
15757
15761
if (Op1->getValueID() < Op2->getValueID())
15758
15762
return !IsCompatibility;
15759
15763
if (Op1->getValueID() > Op2->getValueID())
@@ -15780,7 +15784,10 @@ static bool compareCmp(Value *V, Value *V2, TargetLibraryInfo &TLI,
15780
15784
InstructionsState S = getSameOpcode({I1, I2}, TLI);
15781
15785
if (S.getOpcode() && (IsCompatibility || !S.isAltShuffle()))
15782
15786
continue;
15783
- return !IsCompatibility && I1->getOpcode() < I2->getOpcode();
15787
+ if (IsCompatibility)
15788
+ return false;
15789
+ if (I1->getOpcode() != I2->getOpcode())
15790
+ return I1->getOpcode() < I2->getOpcode();
15784
15791
}
15785
15792
}
15786
15793
return IsCompatibility;
0 commit comments