From 55e4dcad36c4060bfba354ebffff4b041789f0ba Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Wed, 18 Oct 2006 19:08:31 +0000 Subject: [PATCH] Add option for controlling inclusion of global AA. llvm-svn: 31040 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 3c260d310ca1..a4d3c54e1c3b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -51,6 +51,10 @@ namespace { CombinerAA("combiner-alias-analysis", cl::Hidden, cl::desc("Turn on alias analysis during testing")); + static cl::opt + CombinerGlobalAA("combiner-global-alias-analysis", cl::Hidden, + cl::desc("Include global information in alias analysis")); + //------------------------------ DAGCombiner ---------------------------------// class VISIBILITY_HIDDEN DAGCombiner { @@ -4036,13 +4040,15 @@ bool DAGCombiner::isAlias(SDOperand Ptr1, int64_t Size1, // If we know both bases then they can't alias. if (KnownBase1 && KnownBase2) return false; - // Use alias analysis information. - int Overlap1 = Size1 + SrcValueOffset1 + Offset1; - int Overlap2 = Size2 + SrcValueOffset2 + Offset2; - AliasAnalysis::AliasResult AAResult = + if (CombinerGlobalAA) { + // Use alias analysis information. + int Overlap1 = Size1 + SrcValueOffset1 + Offset1; + int Overlap2 = Size2 + SrcValueOffset2 + Offset2; + AliasAnalysis::AliasResult AAResult = AA.alias(SrcValue1, Overlap1, SrcValue2, Overlap2); - if (AAResult == AliasAnalysis::NoAlias) - return false; + if (AAResult == AliasAnalysis::NoAlias) + return false; + } // Otherwise we have to assume they alias. return true;