29struct LowerWidenableConditionLegacyPass :
public FunctionPass {
43 auto *WCDecl =
F.getParent()->getFunction(
45 if (!WCDecl || WCDecl->use_empty())
53 for (
auto *U : WCDecl->users())
54 if (
auto *CI = dyn_cast<CallInst>(U))
55 if (CI->getFunction() == &
F)
61 for (
auto *CI : ToLower) {
63 CI->eraseFromParent();
68bool LowerWidenableConditionLegacyPass::runOnFunction(
Function &
F) {
72char LowerWidenableConditionLegacyPass::ID = 0;
74 "Lower the widenable condition to default true value",
false,
78 return new LowerWidenableConditionLegacyPass();
static bool lowerWidenableCondition(Function &F)
Module.h This file contains the declarations for the Module class.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
A container for analyses that lazily runs them and caches their results.
static ConstantInt * getTrue(LLVMContext &Context)
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Pass interface - Implemented by all 'passes'.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
This is an optimization pass for GlobalISel generic memory operations.
void initializeLowerWidenableConditionLegacyPassPass(PassRegistry &)
Pass * createLowerWidenableConditionPass()
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)