[LLVMbugs] [Bug 15777] New: SROA::performScalarRepl comment claims to work on all alloca's in function, but it only add ones in the entry block

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 18 02:05:51 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15777

            Bug ID: 15777
           Summary: SROA::performScalarRepl comment claims to work on all
                    alloca's in function, but it only add ones in the
                    entry block
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: sschiffli at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Here is the code snippet that I am confused about:
...
// performScalarRepl - This algorithm is a simple worklist driven algorithm,
// which runs on all of the alloca instructions in the function, removing them
// if they are only used by getelementptr instructions.
//
bool SROA::performScalarRepl(Function &F) {
  std::vector<AllocaInst*> WorkList;

  // Scan the entry basic block, adding allocas to the worklist.
  BasicBlock &BB = F.getEntryBlock();
  for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
    if (AllocaInst *A = dyn_cast<AllocaInst>(I))
      WorkList.push_back(A);
...

Is it a code bug in that we are supposed to add all alloca's in the function to
the worklist?  Or is this a comment bug, or something else that I am missing.

Would there be any reason to only allow alloca's in the entry block to be
optimized?  I played around with adding all, and it fixed the optimization bug
I was seeing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130418/01444da0/attachment.html>


More information about the llvm-bugs mailing list