CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
//===- ProvenanceAnalysisEvaluator.cpp - ObjC ARC Optimization ------------===//
|
|
//
|
|
// 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 "ProvenanceAnalysis.h"
|
|
#include "llvm/Transforms/ObjCARC.h"
|
|
#include "llvm/ADT/SetVector.h"
|
|
#include "llvm/Analysis/AliasAnalysis.h"
|
|
#include "llvm/IR/Function.h"
|
|
#include "llvm/IR/InstIterator.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
using namespace llvm;
|
|
using namespace llvm::objcarc;
|
|
|
|
static StringRef getName(Value *V) {
|
|
StringRef Name = V->getName();
|
|
if (Name.starts_with("\1"))
|
|
return Name.substr(1);
|
|
return Name;
|
|
}
|
|
|
|
static void insertIfNamed(SetVector<Value *> &Values, Value *V) {
|
|
if (!V->hasName())
|
|
return;
|
|
if (!V->getType()->isPointerTy())
|
|
return;
|
|
Values.insert(V);
|
|
}
|
|
|
|
PreservedAnalyses PAEvalPass::run(Function &F, FunctionAnalysisManager &AM) {
|
|
SetVector<Value *> Values;
|
|
|
|
for (auto &Arg : F.args())
|
|
insertIfNamed(Values, &Arg);
|
|
|
|
for (Instruction &I : instructions(F)) {
|
|
insertIfNamed(Values, &I);
|
|
|
|
for (auto &Op : I.operands())
|
|
insertIfNamed(Values, Op);
|
|
}
|
|
|
|
ProvenanceAnalysis PA;
|
|
PA.setAA(&AM.getResult<AAManager>(F));
|
|
|
|
for (Value *V1 : Values) {
|
|
StringRef NameV1 = getName(V1);
|
|
for (Value *V2 : Values) {
|
|
StringRef NameV2 = getName(V2);
|
|
if (NameV1 >= NameV2)
|
|
continue;
|
|
errs() << NameV1 << " and " << NameV2;
|
|
if (PA.related(V1, V2))
|
|
errs() << " are related.\n";
|
|
else
|
|
errs() << " are not related.\n";
|
|
}
|
|
}
|
|
|
|
return PreservedAnalyses::all();
|
|
}
|