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

            Bug ID: 22583
           Summary: [EarlyCSE] Missed trivial dead store case
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Early CSE currently does not handle this case:
; Function Attrs: readonly
declare void @readmem() #0

define void @test(i64* %ptr) {
  %v = load i64* %ptr
  store i64 %v, i64* %ptr
  call void @readmem()
  ret void
}

attributes #0 = { readonly }

The store is dead since it's writing back the same value which was read.  Given
both are simple (non volatile, non ordered) the store can just be removed.

EarlyCSE has all the information to do this.  Load is part of the available
load set.  We know we haven't crossed an ordering set (if available load set is
non-empty).

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