1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

[CallSite removal][Analysis] Use CallBase instead of CallSite in SparsePropagation unit test. NFC

This commit is contained in:
Craig Topper 2020-04-19 22:39:24 -07:00
parent 1a015d50b1
commit c168418ffb

View File

@ -8,7 +8,6 @@
#include "llvm/Analysis/SparsePropagation.h" #include "llvm/Analysis/SparsePropagation.h"
#include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/PointerIntPair.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
using namespace llvm; using namespace llvm;
@ -143,7 +142,7 @@ public:
SparseSolver<TestLatticeKey, TestLatticeVal> &SS) override { SparseSolver<TestLatticeKey, TestLatticeVal> &SS) override {
switch (I.getOpcode()) { switch (I.getOpcode()) {
case Instruction::Call: case Instruction::Call:
return visitCallSite(cast<CallInst>(&I), ChangedValues, SS); return visitCallBase(cast<CallBase>(I), ChangedValues, SS);
case Instruction::Ret: case Instruction::Ret:
return visitReturn(*cast<ReturnInst>(&I), ChangedValues, SS); return visitReturn(*cast<ReturnInst>(&I), ChangedValues, SS);
case Instruction::Store: case Instruction::Store:
@ -158,12 +157,11 @@ private:
/// of the current formal argument state with the call site's corresponding /// of the current formal argument state with the call site's corresponding
/// actual argument state. The call site state is the merge of the call site /// actual argument state. The call site state is the merge of the call site
/// state with the returned value state of the called function. /// state with the returned value state of the called function.
void visitCallSite(CallSite CS, void visitCallBase(CallBase &I,
DenseMap<TestLatticeKey, TestLatticeVal> &ChangedValues, DenseMap<TestLatticeKey, TestLatticeVal> &ChangedValues,
SparseSolver<TestLatticeKey, TestLatticeVal> &SS) { SparseSolver<TestLatticeKey, TestLatticeVal> &SS) {
Function *F = CS.getCalledFunction(); Function *F = I.getCalledFunction();
Instruction *I = CS.getInstruction(); auto RegI = TestLatticeKey(&I, IPOGrouping::Register);
auto RegI = TestLatticeKey(I, IPOGrouping::Register);
if (!F) { if (!F) {
ChangedValues[RegI] = getOverdefinedVal(); ChangedValues[RegI] = getOverdefinedVal();
return; return;
@ -172,7 +170,7 @@ private:
for (Argument &A : F->args()) { for (Argument &A : F->args()) {
auto RegFormal = TestLatticeKey(&A, IPOGrouping::Register); auto RegFormal = TestLatticeKey(&A, IPOGrouping::Register);
auto RegActual = auto RegActual =
TestLatticeKey(CS.getArgument(A.getArgNo()), IPOGrouping::Register); TestLatticeKey(I.getArgOperand(A.getArgNo()), IPOGrouping::Register);
ChangedValues[RegFormal] = ChangedValues[RegFormal] =
MergeValues(SS.getValueState(RegFormal), SS.getValueState(RegActual)); MergeValues(SS.getValueState(RegFormal), SS.getValueState(RegActual));
} }