[LLVMbugs] [Bug 4855] New: Missed optimization on pointer known equal to a constant global

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Sep 1 15:43:01 PDT 2009


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

           Summary: Missed optimization on pointer known equal to a constant
                    global
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: nicholas at mxc.ca, llvmbugs at cs.uiuc.edu
            Blocks: 1772


The following module is a fixed point under "opt -O3", while the optimizers
ought to replace "load i8* %a" with "load i8* @gv" and then realize that
loading it produces a constant value. "opt -predsimplify -O3" successfully
optimizes it.


; ModuleID = '<stdin>'
@gv = internal constant i8 7            ; <i8*> [#uses=1]

define i8 @f(i8* %a) nounwind {
entry:
        %cond = icmp eq i8* %a, @gv             ; <i1> [#uses=1]
        br i1 %cond, label %bb2, label %bb

bb:             ; preds = %entry
        ret i8 0

bb2:            ; preds = %entry
        %should_be_const = load i8* %a          ; <i8> [#uses=1]
        ret i8 %should_be_const
}


This seems related to PR1768, but Nick assures me they're different.

I'm interested because this is the form I was planning to use for Unladen
Swallow's type guards.


-- 
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.



More information about the llvm-bugs mailing list