[PATCH] D16340: Cache results of WalkChainUsers() in SelectionDAG

Z. Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 17:59:46 PST 2016


zzheng created this revision.
zzheng added reviewers: hfinkel, apazos, atrick, mcrosier, resistor.
zzheng added a subscriber: llvm-commits.
zzheng set the repository for this revision to rL LLVM.

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
}

Repository:
  rL LLVM

http://reviews.llvm.org/D16340

Files:
  lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  test/CodeGen/Generic/token-compile-time.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16340.45331.patch
Type: text/x-patch
Size: 31390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160120/d42f7c77/attachment.bin>


More information about the llvm-commits mailing list