aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/X86InstrInfo.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-12 00:10:52 +0000
committerDan Gohman <gohman@apple.com>2008-07-12 00:10:52 +0000
commitcddc11e7570893233af8e84dfb8e7f0f9ab0090d (patch)
tree85c63075a9070e7cd0d818346341fdb13758d1f2 /lib/Target/X86/X86InstrInfo.cpp
parente6acf36dca9864c6ead9113f0322f174469810cc (diff)
downloadexternal_llvm-cddc11e7570893233af8e84dfb8e7f0f9ab0090d.zip
external_llvm-cddc11e7570893233af8e84dfb8e7f0f9ab0090d.tar.gz
external_llvm-cddc11e7570893233af8e84dfb8e7f0f9ab0090d.tar.bz2
Add a utility function to MachineInstr for testing whether an instruction
has exactly one MachineMemOperand, and change some X86 lowering code to make use of it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53498 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index 7822ed7..2f191ff 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -2030,14 +2030,10 @@ MachineInstr* X86InstrInfo::foldMemoryOperand(MachineFunction &MF,
// Check switch flag
if (NoFusing) return NULL;
+ // Determine the alignment of the load.
unsigned Alignment = 0;
- for (alist<MachineMemOperand>::iterator i = LoadMI->memoperands_begin(),
- e = LoadMI->memoperands_end(); i != e; ++i) {
- const MachineMemOperand &MRO = *i;
- unsigned Align = MRO.getAlignment();
- if (Align > Alignment)
- Alignment = Align;
- }
+ if (LoadMI->hasOneMemOperand())
+ Alignment = LoadMI->memoperands_begin()->getAlignment();
// FIXME: Move alignment requirement into tables?
if (Alignment < 16) {