[llvm] [GVN] No need to swap if both LHS and RHS are arguments (PR #95566)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 18:36:32 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)))
----------------
dtcxzyw wrote:
What's the benefit of this change? Can you provide some motivating cases?
https://github.com/llvm/llvm-project/pull/95566
More information about the llvm-commits
mailing list