summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-07-14 02:51:41 +0000
committerDavide Italiano <davide@freebsd.org>2016-07-14 02:51:41 +0000
commit7dac027ed7513f330567f3ae67e70ee13c7e34a5 (patch)
tree06bc019e1b5c543a9f09dcc3b1089535a49f984d /llvm/lib/Transforms
parent622ef17f5d0423f0d8659f412770060a910904ef (diff)
downloadbcm5719-llvm-7dac027ed7513f330567f3ae67e70ee13c7e34a5.tar.gz
bcm5719-llvm-7dac027ed7513f330567f3ae67e70ee13c7e34a5.zip
[IPSCCP] Constant fold struct argument/instructions when all the lattice values are constant.
This now should also work with the interprocedural variant of the pass. Slightly easier now that the yak is shaved. Differential Revision: http://reviews.llvm.org/D22329 llvm-svn: 275363
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 02ffad47bee..61905a34246 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -1766,11 +1766,8 @@ static bool runIPSCCP(Module &M, const DataLayout &DL,
if (Solver.isBlockExecutable(&F.front())) {
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E;
++AI) {
- if (AI->use_empty() || AI->getType()->isStructTy()) continue;
-
- // TODO: Could use getStructLatticeValueFor to find out if the entire
- // result is a constant and replace it entirely if so.
-
+ if (AI->use_empty())
+ continue;
if (tryToReplaceWithConstant(Solver, &*AI))
++IPNumArgsElimed;
}
@@ -1793,12 +1790,8 @@ static bool runIPSCCP(Module &M, const DataLayout &DL,
for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) {
Instruction *Inst = &*BI++;
- if (Inst->getType()->isVoidTy() || Inst->getType()->isStructTy())
+ if (Inst->getType()->isVoidTy())
continue;
-
- // TODO: Could use getStructLatticeValueFor to find out if the entire
- // result is a constant and replace it entirely if so.
-
if (tryToReplaceInstWithConstant(
Solver, Inst,
!isa<CallInst>(Inst) &&
OpenPOWER on IntegriCloud