https://bugs.llvm.org/show_bug.cgi?id=38933
Bug ID: 38933
Summary: [licm] LICM cannot hoist load of global with
llvm.invariant.start
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedb...@nondot.org
Reporter: mpfe...@gmail.com
CC: llvm-bugs@lists.llvm.org
I have a global variable and have marked it with llvm.invariant.start.
I would expect LICM to hoist the load of the global variable out of a loop
under these conditions, but it does not.
One potential issue is that isLoadInvariantInLoop only handles the case when
the load address refers one or more bitcast instructions, which is not true in
this example.
Try this with opt test.ll -licm -S
@chpl_privateObjects = external dso_local global i8**, align 8
declare void @foo()
declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
declare void @llvm.invariant.end.p0i8({}*, i64, i8* nocapture) nounwind
define i8 @test_licm_global(i32 %n) {
entry:
%invst = tail call {}* @llvm.invariant.start.p0i8(i64 8, i8* bitcast (i8***
@chpl_privateObjects to i8*)) #4
br label %loop
loop:
%indvar = phi i32 [ %indvar.next, %loop ], [ 0, %entry ]
%sum = phi i8 [ %sum.next, %loop ], [ 0, %entry ]
%g = load i8**, i8*** @chpl_privateObjects, align 8
%p = load i8*, i8** %g, align 8
%v = load i8, i8* %p, align 8
call void @foo()
%sum.next = add i8 %v, %sum
%indvar.next = add i32 %indvar, 1
%cond = icmp slt i32 %indvar.next, %n
br i1 %cond, label %loop, label %loopexit
loopexit:
ret i8 %sum
}
attributes #4 = { nounwind }
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs