/// when testing to isolate a single AA implementation.
cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false));
+#ifndef NDEBUG
+/// Print a trace of alias analysis queries and their results.
+static cl::opt<bool> EnableAATrace("aa-trace", cl::Hidden, cl::init(false));
+#else
+static const bool EnableAATrace = false;
+#endif
+
AAResults::AAResults(AAResults &&Arg)
: TLI(Arg.TLI), AAs(std::move(Arg.AAs)), AADeps(std::move(Arg.AADeps)) {
for (auto &AA : AAs)
const MemoryLocation &LocB, AAQueryInfo &AAQI) {
AliasResult Result = MayAlias;
+ if (EnableAATrace) {
+ for (unsigned I = 0; I < AAQI.Depth; ++I)
+ dbgs() << " ";
+ dbgs() << "Start " << *LocA.Ptr << " @ " << LocA.Size << ", "
+ << *LocB.Ptr << " @ " << LocB.Size << "\n";
+ }
+
AAQI.Depth++;
for (const auto &AA : AAs) {
Result = AA->alias(LocA, LocB, AAQI);
}
AAQI.Depth--;
+ if (EnableAATrace) {
+ for (unsigned I = 0; I < AAQI.Depth; ++I)
+ dbgs() << " ";
+ dbgs() << "End " << *LocA.Ptr << " @ " << LocA.Size << ", "
+ << *LocB.Ptr << " @ " << LocB.Size << " = " << Result << "\n";
+ }
+
if (AAQI.Depth == 0) {
if (Result == NoAlias)
++NumNoAlias;