[llvm] [ValueTracking] Analyze `Select` in `isKnownNonEqual`. (PR #68427)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 01:08:48 PDT 2023


================
@@ -3112,6 +3112,25 @@ static bool isNonEqualPHIs(const PHINode *PN1, const PHINode *PN2,
   return true;
 }
 
+static bool isNonEqualSelect(const Value *V1, const Value *V2, unsigned Depth,
+                             const SimplifyQuery &Q) {
+  const SelectInst *SI1 = dyn_cast<SelectInst>(V1);
+  if (!SI1)
+    return false;
+
+  if (const SelectInst *SI2 = dyn_cast<SelectInst>(V2)) {
+    const Value *Cond1 = SI1->getCondition();
+    const Value *Cond2 = SI2->getCondition();
+    if (Cond1 == Cond2)
----------------
nikic wrote:

```suggestion
    if (SI1->getCondition() == SI2->getCondition())
```
Unnecessary variables.

https://github.com/llvm/llvm-project/pull/68427


More information about the llvm-commits mailing list