[PATCH] D18830: [llvm] GVN.cpp: Do not swap when both LHS and RHS are arguments.
Aditya Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 09:01:35 PDT 2016
hiraditya created this revision.
hiraditya added reviewers: chandlerc, mcrosier, joker.eph, sebpop.
hiraditya added a subscriber: llvm-commits.
hiraditya set the repository for this revision to rL LLVM.
Prevent swapping of operands when both LHS and RHS are arguments.
Passes llvm regression
Repository:
rL LLVM
http://reviews.llvm.org/D18830
Files:
llvm/lib/Transforms/Scalar/GVN.cpp
Index: llvm/lib/Transforms/Scalar/GVN.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/GVN.cpp
+++ llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1892,7 +1892,8 @@
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)))
std::swap(LHS, RHS);
assert((isa<Argument>(LHS) || isa<Instruction>(LHS)) && "Unexpected value!");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18830.52811.patch
Type: text/x-patch
Size: 608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160406/ae45ea55/attachment.bin>
More information about the llvm-commits
mailing list