[llvm] [GVN] No need to swap if both LHS and RHS are arguments (PR #95566)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 15 07:40:20 PDT 2024
================
@@ -2472,7 +2472,8 @@ bool GVNPass::propagateEquality(Value *LHS, Value *RHS,
continue;
// Prefer a constant on the right-hand side, or an Argument if no constants.
- if (isa<Constant>(LHS) || (isa<Argument>(LHS) && !isa<Constant>(RHS)))
+ if (isa<Constant>(LHS) ||
+ (isa<Argument>(LHS) && !isa<Argument>(RHS) && !isa<Constant>(RHS)))
----------------
nikic wrote:
I think this doesn't make a functional difference at all, because we will later sort the two Argument case by value number.
I think if you're going to refactor this, what you might want to do is extract the common code from the assume and equality handling, which both basically do the same thing in slightly different ways.
https://github.com/llvm/llvm-project/pull/95566
More information about the llvm-commits
mailing list