We found the following loop, after unrolled by a large factor, can cause infinite compile-time spent in WalkChainUsers() when -combiner-alias-analysis is enabled. This issue was first report by Chad on: https://llvm.org/bugs/show_bug.cgi?id=21759.
In this patch, we appended the proposed fix in the bug report with a test case. The test case is derived from the loop below with 'opt -loop-unroll -unroll-threshold=700 -unroll-allow-paritial'.
define void @foo(i32* nocapture %a) #0 { entry: br label %for.body for.body: %count = phi i64 [ %dec, %for.body ], [ 3000, %entry ] %addr = phi i32* [ %gep, %for.body ], [ %a, %entry ] %dec = add nsw i64 %count, -8 %gep = getelementptr inbounds i32, i32* %addr, i64 8 %cmp = icmp eq i64 %count, 8 %cast = bitcast i32* %addr to i8* call void @llvm.memset.p0i8.i64(i8* %cast, i8 0, i64 32, i32 4, i1 false) br i1 %cmp, label %exit, label %for.body exit: ret void }
Avoid the static string "3.8.0" as this will make the test a failure some time in future