[llvm-bugs] [Bug 28097] New: Constant store not optimized out of the loop
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jun 12 08:46:21 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28097
Bug ID: 28097
Summary: Constant store not optimized out of the loop
Product: libraries
Version: 3.8
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: yyc1992 at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
In the following IR, there are only one store and one load in the loop.
The store has a constant address and constant value and is always executed
before the load so it should be fine to move it outside the loop even if the
load and the store can alias. However, `opt` does not do this optimization at
any optimization level.
```
; ModuleID = 'c.ll'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: norecurse nounwind
define double @julia_mysum_simd2_64926(double** nocapture %slot, i64 %len,
double* %ptr) #0 {
top:
br label %if22
if22: ; preds = %if22, %top
%i = phi i64 [ %3, %if22 ], [ 0, %top ]
%s.128 = phi double [ %2, %if22 ], [ 0.000000e+00, %top ]
store double* %ptr, double** %slot, align 8, !tbaa !0,
!llvm.mem.parallel_loop_access !3
%0 = getelementptr double, double* %ptr, i64 %i
%1 = load double, double* %0, align 8, !llvm.mem.parallel_loop_access !3
%2 = fadd fast double %1, %s.128
%3 = add nuw nsw i64 %i, 1, !simd_loop !5
%exitcond = icmp eq i64 %3, %len
br i1 %exitcond, label %L18, label %if22, !llvm.loop !4
L18: ; preds = %if22
%.lcssa = phi double [ %2, %if22 ]
ret double %.lcssa
}
attributes #0 = { norecurse nounwind }
!0 = !{!1, !1, i64 0}
!1 = !{!"jtbaa_gcframe", !2}
!2 = !{!"jtbaa"}
!3 = !{!4}
!4 = distinct !{!4}
!5 = !{}
```
--
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/20160612/457591be/attachment.html>
More information about the llvm-bugs
mailing list