//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "ReduceOperandsSkip.h" #include "llvm/ADT/Sequence.h" #include "llvm/ADT/SetVector.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Dominators.h" #include "llvm/IR/InstIterator.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Operator.h" #include <queue> usingnamespacellvm; /// Collect all values that are directly or indirectly referenced by @p Root, /// including Root itself. This is a BF search such that the more steps needed /// to get to the reference, the more behind it is found in @p Collection. Each /// step could be its own reduction, therefore we consider later values "more /// reduced". static SetVector<Value *> collectReferencedValues(Value *Root) { … } static bool shouldReduceOperand(Use &Op) { … } /// Return a reduction priority for @p V. A higher values means "more reduced". static int classifyReductivePower(Value *V) { … } /// Calls @p Callback for every reduction opportunity in @p F. Used by /// countOperands() and extractOperandsFromModule() to ensure consistency /// between the two. static void opportunities(Function &F, function_ref<void(Use &, ArrayRef<Value *>)> Callback) { … } static void extractOperandsFromModule(Oracle &O, ReducerWorkItem &WorkItem) { … } void llvm::reduceOperandsSkipDeltaPass(TestRunner &Test) { … }