mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	Use cast<> instead of dyn_cast<> for things that are known to be
Instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73002 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -932,8 +932,7 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, | |||||||
|                                                       GlobalVariable *GV, |                                                       GlobalVariable *GV, | ||||||
|                                               SmallPtrSet<PHINode*, 8> &PHIs) { |                                               SmallPtrSet<PHINode*, 8> &PHIs) { | ||||||
|   for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){ |   for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){ | ||||||
|     Instruction *Inst = dyn_cast<Instruction>(*UI); |     Instruction *Inst = cast<Instruction>(*UI); | ||||||
|     if (Inst == 0) return false; |  | ||||||
|      |      | ||||||
|     if (isa<LoadInst>(Inst) || isa<CmpInst>(Inst)) { |     if (isa<LoadInst>(Inst) || isa<CmpInst>(Inst)) { | ||||||
|       continue; // Fine, ignore. |       continue; // Fine, ignore. | ||||||
|   | |||||||
| @@ -241,15 +241,11 @@ bool IPCP::PropagateConstantReturn(Function &F) { | |||||||
|     |     | ||||||
|     for (Value::use_iterator I = Call->use_begin(), E = Call->use_end(); |     for (Value::use_iterator I = Call->use_begin(), E = Call->use_end(); | ||||||
|          I != E;) { |          I != E;) { | ||||||
|       Instruction *Ins = dyn_cast<Instruction>(*I); |       Instruction *Ins = cast<Instruction>(*I); | ||||||
|  |  | ||||||
|       // Increment now, so we can remove the use |       // Increment now, so we can remove the use | ||||||
|       ++I; |       ++I; | ||||||
|  |  | ||||||
|       // Not an instruction? Ignore |  | ||||||
|       if (!Ins) |  | ||||||
|         continue; |  | ||||||
|  |  | ||||||
|       // Find the index of the retval to replace with |       // Find the index of the retval to replace with | ||||||
|       int index = -1; |       int index = -1; | ||||||
|       if (ExtractValueInst *EV = dyn_cast<ExtractValueInst>(Ins)) |       if (ExtractValueInst *EV = dyn_cast<ExtractValueInst>(Ins)) | ||||||
|   | |||||||
| @@ -1525,12 +1525,12 @@ namespace { | |||||||
|         Instruction *I2 = dyn_cast<Instruction>(R); |         Instruction *I2 = dyn_cast<Instruction>(R); | ||||||
|         if (I2 && below(I2)) { |         if (I2 && below(I2)) { | ||||||
|           std::vector<Instruction *> ToNotify; |           std::vector<Instruction *> ToNotify; | ||||||
|           for (Value::use_iterator UI = R->use_begin(), UE = R->use_end(); |           for (Value::use_iterator UI = I2->use_begin(), UE = I2->use_end(); | ||||||
|                UI != UE;) { |                UI != UE;) { | ||||||
|             Use &TheUse = UI.getUse(); |             Use &TheUse = UI.getUse(); | ||||||
|             ++UI; |             ++UI; | ||||||
|             if (Instruction *I = dyn_cast<Instruction>(TheUse.getUser())) |             Instruction *I = cast<Instruction>(TheUse.getUser()); | ||||||
|               ToNotify.push_back(I); |             ToNotify.push_back(I); | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           DOUT << "Simply removing " << *I2 |           DOUT << "Simply removing " << *I2 | ||||||
| @@ -1658,10 +1658,9 @@ namespace { | |||||||
|           ++UI; |           ++UI; | ||||||
|           Value *V = TheUse.getUser(); |           Value *V = TheUse.getUser(); | ||||||
|           if (!V->use_empty()) { |           if (!V->use_empty()) { | ||||||
|             if (Instruction *Inst = dyn_cast<Instruction>(V)) { |             Instruction *Inst = cast<Instruction>(V); | ||||||
|               if (aboveOrBelow(Inst)) |             if (aboveOrBelow(Inst)) | ||||||
|                 opsToDef(Inst); |               opsToDef(Inst); | ||||||
|             } |  | ||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
| @@ -2262,10 +2261,9 @@ namespace { | |||||||
|                    UE = O.LHS->use_end(); UI != UE;) { |                    UE = O.LHS->use_end(); UI != UE;) { | ||||||
|                 Use &TheUse = UI.getUse(); |                 Use &TheUse = UI.getUse(); | ||||||
|                 ++UI; |                 ++UI; | ||||||
|                 if (Instruction *I = dyn_cast<Instruction>(TheUse.getUser())) { |                 Instruction *I = cast<Instruction>(TheUse.getUser()); | ||||||
|                   if (aboveOrBelow(I)) |                 if (aboveOrBelow(I)) | ||||||
|                     opsToDef(I); |                   opsToDef(I); | ||||||
|                 } |  | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
|             if (Instruction *I2 = dyn_cast<Instruction>(O.RHS)) { |             if (Instruction *I2 = dyn_cast<Instruction>(O.RHS)) { | ||||||
| @@ -2277,10 +2275,9 @@ namespace { | |||||||
|                    UE = O.RHS->use_end(); UI != UE;) { |                    UE = O.RHS->use_end(); UI != UE;) { | ||||||
|                 Use &TheUse = UI.getUse(); |                 Use &TheUse = UI.getUse(); | ||||||
|                 ++UI; |                 ++UI; | ||||||
|                 if (Instruction *I = dyn_cast<Instruction>(TheUse.getUser())) { |                 Instruction *I = cast<Instruction>(TheUse.getUser()); | ||||||
|                   if (aboveOrBelow(I)) |                 if (aboveOrBelow(I)) | ||||||
|                     opsToDef(I); |                   opsToDef(I); | ||||||
|                 } |  | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|   | |||||||
| @@ -1228,7 +1228,8 @@ void SROA::CleanupAllocaUsers(AllocationInst *AI) { | |||||||
|     User *U = *UI++; |     User *U = *UI++; | ||||||
|     if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) |     if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) | ||||||
|       CleanupGEP(GEPI); |       CleanupGEP(GEPI); | ||||||
|     else if (Instruction *I = dyn_cast<Instruction>(U)) { |     else { | ||||||
|  |       Instruction *I = cast<Instruction>(U); | ||||||
|       SmallVector<DbgInfoIntrinsic *, 2> DbgInUses; |       SmallVector<DbgInfoIntrinsic *, 2> DbgInUses; | ||||||
|       if (!isa<StoreInst>(I) && OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) { |       if (!isa<StoreInst>(I) && OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) { | ||||||
|         // Safe to remove debug info uses. |         // Safe to remove debug info uses. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user