|
LLVM 24.0.0git
|
This transformation implements the well known scalar replacement of aggregates transformation but for logical pointers. More...
#include "llvm/Transforms/Scalar/LogicalSROA.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/Analysis/DomTreeUpdater.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/PassManager.h"#include "llvm/InitializePasses.h"#include "llvm/Pass.h"#include "llvm/Transforms/Scalar.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "logical-sroa" |
Functions | |
| static SmallVector< LifetimeIntrinsic * > | collectLifetimeIntrinsicsUsing (Instruction &I) |
| static bool | isAllocaSplittable (StructuredAllocaInst &SAI) |
| static SmallVector< SmallVector< StructuredGEPInst * > > | collectPerFieldSGEP (StructuredAllocaInst &SAI) |
| static void | copyLifetimeIntrinsicFor (IRBuilder<> &B, LifetimeIntrinsic *II, Value *V) |
| static void | rewriteSGEPChain (IRBuilder<> &B, StructuredGEPInst *SGEP, StructuredAllocaInst *FieldAlloca) |
| static bool | runOnStructuredAlloca (StructuredAllocaInst &SAI) |
| static bool | runLogicalSROA (Function &F) |
This transformation implements the well known scalar replacement of aggregates transformation but for logical pointers.
It tries to identify promotable elements of an aggregate alloca, and promote them to multiple allocas of scalar type.
FIXME: nested aggregates are not fully optimized (#192619). FIXME: array are not optimized (#192620).
Definition in file LogicalSROA.cpp.
| #define DEBUG_TYPE "logical-sroa" |
Definition at line 32 of file LogicalSROA.cpp.
|
static |
Definition at line 36 of file LogicalSROA.cpp.
References llvm::dyn_cast(), I, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by runOnStructuredAlloca().
|
static |
Definition at line 120 of file LogicalSROA.cpp.
References assert(), llvm::cast(), llvm::StructuredAllocaInst::getAllocationType(), llvm::isa(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::Value::users().
Referenced by runOnStructuredAlloca().
|
static |
Definition at line 141 of file LogicalSROA.cpp.
References B(), II, and llvm_unreachable.
Referenced by runOnStructuredAlloca().
|
static |
Definition at line 49 of file LogicalSROA.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::detail::DenseSetImpl< ValueT, MapTy >::contains(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), I, llvm::detail::DenseSetImpl< ValueT, MapTy >::insert(), llvm::isa(), llvm::SmallVectorTemplateBase< T, bool >::pop_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Value::users().
Referenced by runOnStructuredAlloca().
|
static |
Definition at line 153 of file LogicalSROA.cpp.
References B(), llvm::drop_begin(), llvm::Instruction::eraseFromParent(), llvm::StructuredAllocaInst::getAllocationType(), llvm::Value::getName(), llvm::StructuredGEPInst::getNumIndices(), I, llvm::StructuredGEPInst::indices(), and llvm::Value::replaceAllUsesWith().
Referenced by runOnStructuredAlloca().
Definition at line 204 of file LogicalSROA.cpp.
References Changed, llvm::dyn_cast(), F, I, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and runOnStructuredAlloca().
Referenced by llvm::LogicalSROAPass::run().
|
static |
Definition at line 169 of file LogicalSROA.cpp.
References assert(), B(), llvm::cast(), collectLifetimeIntrinsicsUsing(), collectPerFieldSGEP(), copyLifetimeIntrinsicFor(), llvm::dyn_cast(), llvm::enumerate(), llvm::Instruction::eraseFromParent(), llvm::StructuredAllocaInst::getAllocationType(), II, isAllocaSplittable(), rewriteSGEPChain(), and Users.
Referenced by runLogicalSROA().