[LLVMbugs] [Bug 23055] New: Simplify store values that can be proven constant

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 28 10:54:19 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23055

            Bug ID: 23055
           Summary: Simplify store values that can be proven constant
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: josh.klontz at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14110
  --> https://llvm.org/bugs/attachment.cgi?id=14110&action=edit
Minimum reproducing example

InstCombiner successfully simplifies return values when they can be proven
constant, but misses the same optimization opportunity for store values. This
is illustrated in the attached minimum reproducing example:

  ; ModuleID = 'simplify_constant_store.ll'

  ; Function Attrs: nounwind
  declare void @llvm.assume(i1) #0

  ; Function Attrs: nounwind
  define i32 @convert_grayscale(i32, i32* nocapture) #0 {
  entry:
    %2 = icmp eq i32 %0, 3
    tail call void @llvm.assume(i1 %2)
    %3 = add nuw nsw i32 %0, 1
    store i32 %3, i32* %1, align 4
    ret i32 %3
  }

  attributes #0 = { nounwind }

`ret i32 %3` is correctly simplified to `ret i32 4`. `store i32 %3, i32* %1,
align 4` could be simplified to `store i32 4, i32* %1, align 4`, but is not.

-- 
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/20150328/2d01c821/attachment.html>


More information about the llvm-bugs mailing list