[llvm-commits] [PATCH] Use GetUnderlyingObjects in misched

Andrew Trick atrick at apple.com
Sun Nov 18 23:52:15 PST 2012


On Nov 18, 2012, at 9:30 PM, Hal Finkel <hfinkel at anl.gov> wrote:

>> 
>> +      bool Found = false;
>> +      for (SmallVectorImpl<Value *>::iterator J = Objects.begin(),
>> +           JE = Objects.end(); J != JE; ++J)
>> +        if (V == *J) {
>> +          Found = true;
>> +          break;
>> +        }
>> +
>> +      if (!Found)
>> 
>> Since only visited values are pushed, you should not need this loop.
> 
> Collecting the underlying objects from different IntToPtr instructions could still yield duplicate underlying objects. On the other hand, is it important to insure that the values in the array are unique? (does the scheduler care about the insertion of duplicate edges?)

What if you mark the results of GetUnderlyingObjects visited like this?

+    for (SmallVector<Value *, 4>::iterator I = Objs.begin(), IE = Objs.end();
+         I != IE; ++I) {
+      V = *I;
+    if (!Visited.insert(V))
+      continue;

Then do you still need this?

+          if (!Visited.count(O))
+            Working.push_back(O);

Or this?

+      bool Found = false;
+      for (SmallVectorImpl<Value *>::iterator J = Objects.begin(),
+           JE = Objects.end(); J != JE; ++J)
+        if (V == *J) {
+          Found = true;
+          break;
+        }
+
+      if (!Found)

The scheduler can handle duplicate edges. You just have to be careful not to blow up the DAG.

Otherwise your patch looks great.

-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121118/18acfa34/attachment.html>


More information about the llvm-commits mailing list