From 40aa86751ad87015a45426f25cd0ab3aa6d1b43b Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 23 Aug 2018 15:58:07 +0000 Subject: [PATCH] [x86] add debug option for and-immediate shrinking The commit that added this functionality: rL322957 may be causing/exposing a miscompile in PR38648: https://bugs.llvm.org/show_bug.cgi?id=38648 so allow enabling/disabling to make debugging easier. llvm-svn: 340540 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index 7236fdeb8be2..1cca1f1e14b4 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -41,6 +41,10 @@ using namespace llvm; STATISTIC(NumLoadMoved, "Number of loads moved below TokenFactor"); +static cl::opt AndImmShrink("x86-and-imm-shrink", cl::init(true), + cl::desc("Enable setting constant bits to reduce size of mask immediates"), + cl::Hidden); + //===----------------------------------------------------------------------===// // Pattern Matcher Implementation //===----------------------------------------------------------------------===// @@ -2927,7 +2931,7 @@ void X86DAGToDAGISel::Select(SDNode *Node) { case ISD::AND: if (matchBEXTRFromAnd(Node)) return; - if (shrinkAndImmediate(Node)) + if (AndImmShrink && shrinkAndImmediate(Node)) return; LLVM_FALLTHROUGH;