[llvm-commits] [llvm] r52339 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Evan Cheng evan.cheng at apple.com
Mon Jun 16 12:33:34 PDT 2008


On Jun 16, 2008, at 11:20 AM, Chris Lattner wrote:

>
> On Jun 16, 2008, at 11:17 AM, Evan Cheng wrote:
>
>> Author: evancheng
>> Date: Mon Jun 16 13:17:09 2008
>> New Revision: 52339
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=52339&view=rev
>> Log:
>> Iterating over SmallPtrSet is not deterministic.
>
> Neither is iterating over std::set!  What is the code trying to do?

I thought std::set is ordered? It's visiting every "dead instruction"  
in the set and delete them if possible. It also insert operands of  
dead instructions into the set.

Evan


>
>
> -Chris
>
>>
>>
>> Modified:
>>   llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=52339&r1=52338&r2=52339&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> = 
>> =====================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp  
>> (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Jun
>> 16 13:17:09 2008
>> @@ -136,7 +136,7 @@
>>
>>    /// DeadInsts - Keep track of instructions we may have made
>> dead, so that
>>    /// we can remove them after we are done working.
>> -    SmallPtrSet<Instruction*,16> DeadInsts;
>> +    std::set<Instruction*> DeadInsts;
>>
>>    /// TLI - Keep a pointer of a TargetLowering to consult for
>> determining
>>    /// transformation profitability.
>> @@ -192,7 +192,7 @@
>>    void StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
>>                                      IVUsersOfOneStride &Uses,
>>                                      Loop *L, bool isOnlyStride);
>> -    void DeleteTriviallyDeadInstructions(SmallPtrSet<Instruction*,
>> 16> &Insts);
>> +    void DeleteTriviallyDeadInstructions(std::set<Instruction*>
>> &Insts);
>>  };
>> }
>>
>> @@ -226,7 +226,7 @@
>> /// specified set are trivially dead, delete them and see if this
>> makes any of
>> /// their operands subsequently dead.
>> void LoopStrengthReduce::
>> -DeleteTriviallyDeadInstructions(SmallPtrSet<Instruction*,16>
>> &Insts) {
>> +DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts) {
>>  while (!Insts.empty()) {
>>    Instruction *I = *Insts.begin();
>>    Insts.erase(I);
>> @@ -378,7 +378,7 @@
>> /// should use the post-inc value).
>> static bool IVUseShouldUsePostIncValue(Instruction *User,
>> Instruction *IV,
>>                                       Loop *L, DominatorTree *DT,
>> Pass *P,
>> -                                       SmallPtrSet<Instruction*,16>
>> &DeadInsts){
>> +                                       std::set<Instruction*>
>> &DeadInsts){
>>  // If the user is in the loop, use the preinc value.
>>  if (L->contains(User->getParent())) return false;
>>
>> @@ -546,7 +546,7 @@
>>    void RewriteInstructionToUseNewBase(const SCEVHandle &NewBase,
>>                                        Instruction *InsertPt,
>>                                       SCEVExpander &Rewriter, Loop
>> *L, Pass *P,
>> -                                       SmallPtrSet<Instruction*,16>
>> &DeadInsts);
>> +                                       std::set<Instruction*>
>> &DeadInsts);
>>
>>    Value *InsertCodeForBaseAtPosition(const SCEVHandle &NewBase,
>>                                       SCEVExpander &Rewriter,
>> @@ -612,7 +612,7 @@
>> void BasedUser::RewriteInstructionToUseNewBase(const SCEVHandle
>> &NewBase,
>>                                               Instruction *NewBasePt,
>>                                      SCEVExpander &Rewriter, Loop
>> *L, Pass *P,
>> -                                      SmallPtrSet<Instruction*,16>
>> &DeadInsts) {
>> +                                      std::set<Instruction*>
>> &DeadInsts) {
>>  if (!isa<PHINode>(Inst)) {
>>    // By default, insert code at the user instruction.
>>    BasicBlock::iterator InsertPt = Inst;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list