[LLVMbugs] [Bug 1430] NEW: mem2reg ignores volatile

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed May 16 12:08:44 PDT 2007


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

           Summary: mem2reg ignores volatile
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: djg at cray.com


The mem2reg pass (llvm::isAllocaPromotable, specifically) does not consider
whether the loads/stores it examines are volatile and allows them to be eliminated.

Here's a test case. LLVM optimization eliminates the volatile store and load.

define i32 @foo() {
entry:
        %retval = alloca i32, align 4           ; <i32*> [#uses=2]
        %tmp = alloca i32, align 4              ; <i32*> [#uses=2]
        %x = alloca i32, align 4                ; <i32*> [#uses=2]
        "alloca point" = bitcast i32 0 to i32           ; <i32> [#uses=0]
        volatile store i32 2, i32* %x
        %tmp1 = volatile load i32* %x           ; <i32> [#uses=1]
        store i32 %tmp1, i32* %tmp
        %tmp2 = load i32* %tmp          ; <i32> [#uses=1]
        store i32 %tmp2, i32* %retval
        br label %return

return:         ; preds = %entry
        %retval3 = load i32* %retval            ; <i32> [#uses=1]
        ret i32 %retval3
}



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list