40 StringRef getPassName()
const override {
return "Remove sign extends"; }
54 "Remove Sign and Zero Extends for Args",
false,
false)
56 bool HexagonOptimizeSZextends::intrinsicAlreadySextended(Intrinsic::
ID IntID) {
58 case llvm::Intrinsic::hexagon_A2_addh_l16_sat_ll:
66 bool HexagonOptimizeSZextends::runOnFunction(
Function &
F) {
74 for (
auto &Arg : F.
args()) {
76 if (!isa<PointerType>(Arg.getType())) {
77 for (
auto UI = Arg.use_begin(); UI != Arg.use_end();) {
78 if (isa<SExtInst>(*UI)) {
107 if (!(Ashr && Ashr->
getOpcode() == Instruction::AShr))
117 if (!(Shl && Shl->
getOpcode() == Instruction::Shl))
128 if (!intrinsicAlreadySextended(
I->getIntrinsicID()))
133 const Use &TheUse = UI.getUse();
147 return new HexagonOptimizeSZextends();
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
const Instruction & front() const
This class represents a sign extension of integer types.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
FunctionPass * createHexagonOptimizeSZextends()
A Use represents the edge between a Value definition and its users.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
INITIALIZE_PASS(HexagonOptimizeSZextends,"reargs","Remove Sign and Zero Extends for Args", false, false) bool HexagonOptimizeSZextends
void replaceUsesOfWith(Value *From, Value *To)
Replace uses of one Value with another.
void insertBefore(Instruction *InsertPos)
Insert an unlinked instruction into a basic block immediately before the specified instruction...
void initializeHexagonOptimizeSZextendsPass(PassRegistry &)
Represent the analysis usage information of a pass.
User * getUser() const
Returns the User that contains this Use.
FunctionPass class - This class is used to implement most global optimizations.
Value * getOperand(unsigned i) const
BinaryOps getOpcode() const
This is the shared class of boolean and integer constants.
Type * getType() const
All values are typed, get the type of this value.
const BasicBlock & getEntryBlock() const
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
AttributeSet getAttributes() const
Return the attribute list for this Function.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
getEVT - Return the value type corresponding to the specified type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
user_iterator user_begin()
LLVM Value Representation.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
iterator_range< arg_iterator > args()
A wrapper class for inspecting calls to intrinsic functions.