[llvm-commits] [llvm] r133159 - /llvm/trunk/lib/Target/X86/X86InstrCompiler.td

Dan Gohman gohman at apple.com
Thu Jun 16 08:55:48 PDT 2011


Author: djg
Date: Thu Jun 16 10:55:48 2011
New Revision: 133159

URL: http://llvm.org/viewvc/llvm-project?rev=133159&view=rev
Log:
Add a comment describing why transforming (shl x, 1) to (add x, x) is to be
considered safe enough in this context.

Modified:
    llvm/trunk/lib/Target/X86/X86InstrCompiler.td

Modified: llvm/trunk/lib/Target/X86/X86InstrCompiler.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrCompiler.td?rev=133159&r1=133158&r2=133159&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrCompiler.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrCompiler.td Thu Jun 16 10:55:48 2011
@@ -1368,6 +1368,11 @@
 
 
 // (shl x, 1) ==> (add x, x)
+// Note that if x is undef (immediate or otherwise), we could theoretically
+// end up with the two uses of x getting different values, producing a result
+// where the least significant bit is not 0. However, the probability of this
+// happening is considered low enough that this is officially not a
+// "real problem".
 def : Pat<(shl GR8 :$src1, (i8 1)), (ADD8rr  GR8 :$src1, GR8 :$src1)>;
 def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
 def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;





More information about the llvm-commits mailing list