Add hidden option -x86-fold-and-in-test to test the effect the test / and folding...
authorEvan Cheng <evan.cheng@apple.com>
Tue, 19 Feb 2008 23:36:51 +0000 (23:36 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 19 Feb 2008 23:36:51 +0000 (23:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47351 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelDAGToDAG.cpp
lib/Target/X86/X86InstrInfo.td

index 5822f946e2cf60f838fb8e46fd0aec811f10f7f3..db0c721f7137de92b789421517f9e5332321defc 100644 (file)
@@ -32,6 +32,7 @@
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/SelectionDAGISel.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
@@ -43,6 +44,11 @@ using namespace llvm;
 STATISTIC(NumFPKill   , "Number of FP_REG_KILL instructions added");
 STATISTIC(NumLoadMoved, "Number of loads moved below TokenFactor");
 
+namespace {
+  static cl::opt<bool>
+  FoldAndInTest("x86-fold-and-in-test", cl::desc("Fold and operation in test"),
+                cl::init(true), cl::Hidden);
+}
 
 //===----------------------------------------------------------------------===//
 //                      Pattern Matcher Implementation
index 4482da7d4b11d0f518947045cb5fbb2522138748..276468c8fd29cf49231f104c5f15e9e827831c15 100644 (file)
@@ -248,7 +248,7 @@ def extloadi32i16  : PatFrag<(ops node:$ptr), (i32 (extloadi16 node:$ptr))>;
 
 // An 'and' node with a single use.
 def and_su : PatFrag<(ops node:$lhs, node:$rhs), (and node:$lhs, node:$rhs), [{
-  return N->hasOneUse();
+  return !FoldAndInTest || N->hasOneUse();
 }]>;
 
 //===----------------------------------------------------------------------===//