[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 12 10:38:38 PST 2005



Changes in directory llvm/lib/Target/X86:

X86ISelPattern.cpp updated: 1.49 -> 1.50
---
Log message:

We can only fold a load into an op if there is exactly one use of the value.
Checking to see if the load has two uses is not equivalent, as the chain
value may have zero uses.


---
Diffs of the changes:  (+2 -1)

Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.49 llvm/lib/Target/X86/X86ISelPattern.cpp:1.50
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.49	Wed Jan 12 12:08:53 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp	Wed Jan 12 12:38:26 2005
@@ -979,7 +979,8 @@
   // If this load has already been emitted, we clearly can't fold it.
   if (ExprMap.count(Op)) return false;
 
-  return Op.Val->use_size() == 2;
+  // Finally, there can only be one use of its value.
+  return Op.Val->hasNUsesOfValue(1, 0);
 }
 
 /// EmitFoldedLoad - Ensure that the arguments of the load are code generated,






More information about the llvm-commits mailing list