Push analysis passes to InstSimplify when they're around anyways.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 24 Sep 2013 16:37:40 +0000 (16:37 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 24 Sep 2013 16:37:40 +0000 (16:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191309 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombinePHI.cpp
lib/Transforms/Scalar/CodeGenPrepare.cpp
lib/Transforms/Utils/Local.cpp

index e99eaf3ee250126c97a8362f6f71745ec3f59059..4c6d0c43cd97836e12d9daf06e958445c64f8419 100644 (file)
@@ -790,7 +790,7 @@ Instruction *InstCombiner::SliceUpIllegalIntegerPHI(PHINode &FirstPhi) {
 // PHINode simplification
 //
 Instruction *InstCombiner::visitPHINode(PHINode &PN) {
-  if (Value *V = SimplifyInstruction(&PN, TD))
+  if (Value *V = SimplifyInstruction(&PN, TD, TLI))
     return ReplaceInstUsesWith(PN, V);
 
   // If all PHI operands are the same operation, pull them through the PHI,
index 9c5633b4e7f924fc8d627b91f80183bfc79d5219..9b56a76962779da9b0f301a81e6df89c6cace80f 100644 (file)
@@ -1893,7 +1893,8 @@ bool CodeGenPrepare::OptimizeInst(Instruction *I) {
     // It is possible for very late stage optimizations (such as SimplifyCFG)
     // to introduce PHI nodes too late to be cleaned up.  If we detect such a
     // trivial PHI, go ahead and zap it here.
-    if (Value *V = SimplifyInstruction(P)) {
+    if (Value *V = SimplifyInstruction(P, TLI ? TLI->getDataLayout() : 0,
+                                       TLInfo, DT)) {
       P->replaceAllUsesWith(V);
       P->eraseFromParent();
       ++NumPHIsElim;
index 8f7314d9ca7a1b737be5708cbed07c52b080c02c..56a2d92d47c38bb453d1a368544901e56a92b3d9 100644 (file)
@@ -413,7 +413,7 @@ bool llvm::SimplifyInstructionsInBlock(BasicBlock *BB, const DataLayout *TD,
     Instruction *Inst = BI++;
 
     WeakVH BIHandle(BI);
-    if (recursivelySimplifyInstruction(Inst, TD)) {
+    if (recursivelySimplifyInstruction(Inst, TD, TLI)) {
       MadeChange = true;
       if (BIHandle != BI)
         BI = BB->begin();