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

           Summary: Phi with identical arguments not optimized
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Created an attachment (id=6818)
 --> (http://llvm.org/bugs/attachment.cgi?id=6818)
test.ll

I was curious why early tail dup in CodeGen was seeing trivial bb like

foo:
  jmp bar

since I would expect simplifycfg to handle them.

One case I found is attached. We have code that looks like:

----------------------------
bb0:                   ; preds = %for.body7.i
  %gep0 = getelementptr inbounds i8* %call.i.i.i.i, i64 8
  %cast0 = bitcast i8* %gep0 to %"class.llvm::MallocAllocator"**
  br label %bb2

bb1:                                ; preds = %for.body7.i
  %second.i.i.i.i.i = getelementptr inbounds i8* %call.i.i.i.i, i64 8
  %cast1 = bitcast i8* %second.i.i.i.i.i to %"class.llvm::MallocAllocator"**

  Use of cast1

  br label %bb2

bb2: ; preds = %bb1, %bb0
  %.pre-phi.i.i.i = phi %"class.llvm::MallocAllocator"** [ %cast0, %bb0 ], [
%cast1, %bb1 ]
----------------------------

codegenprepare will move gep0 and cast0, making bb0 empty, but that is too late
for simplifycfg. One way to optimize this early would be to move both the gep
and cast to for.body7.i and remove the phi. After that simplifycfg would remove
bb0.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to