[PATCH] merge consecutive loads that are offset from a base address (PR21771)
hfinkel at anl.gov
hfinkel at anl.gov
Tue Dec 16 12:51:13 PST 2014
With the type changes noted below, LGTM.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6558
@@ +6557,3 @@
+ if (isBaseWithConstantOffset(Loc)) {
+ int LocOffset = cast<ConstantSDNode>(Loc.getOperand(1))->getSExtValue();
+ if (Loc.getOperand(0) == BaseLoc) {
----------------
This is a generic offset, and should be int64_t.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6562
@@ +6561,3 @@
+ // the second load's first add operand should be the base address.
+ if (LocOffset == Dist * (signed)Bytes)
+ return true;
----------------
The LLVM convention is to call the type 'int', not 'signed'. Please say (int)Bytes.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6567
@@ +6566,3 @@
+ // second load's offset before comparing to distance * size.
+ int BOffset = cast<ConstantSDNode>(BaseLoc.getOperand(1))->getSExtValue();
+ if (Loc.getOperand(0) == BaseLoc.getOperand(0)) {
----------------
Same here, this needs to be int64_t.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6569
@@ +6568,3 @@
+ if (Loc.getOperand(0) == BaseLoc.getOperand(0)) {
+ if ((LocOffset - BOffset) == Dist * (signed)Bytes)
+ return true;
----------------
Same here.
http://reviews.llvm.org/D6642
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list