[LLVMbugs] [Bug 23524] New: LoopUnroll pass generates some redundency not being cleaned up
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu May 14 11:06:39 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23524
Bug ID: 23524
Summary: LoopUnroll pass generates some redundency not being
cleaned up
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: wmi at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 14328
--> https://llvm.org/bugs/attachment.cgi?id=14328&action=edit
testcase 1.cc
For testcase 1.cc:
~/workarea/llvm-r236608/build/bin/clang++ -O2 -S 1.cc
The kernel loop in assembly:
.LBB0_9: # %for.body3
# Parent Loop BB0_3 Depth=1
# => This Inner Loop Header: Depth=2
decl %edi
cmpb $0, (%rsi)
jne .LBB0_11
# BB#10: # %if.then
# in Loop: Header=BB0_9 Depth=2
movl $0, (%rdx)
movw $0, 4(%rdx)
.LBB0_11: # %for.inc
# in Loop: Header=BB0_9 Depth=2
leaq 6(%rdx), %rbx
decl %edi # could have been merged with decl %edi above
cmpb $0, 1(%rsi)
jne .LBB0_13
# BB#12: # %if.then.1
# in Loop: Header=BB0_9 Depth=2
movl $0, 6(%rdx)
movw $0, 10(%rdx)
.LBB0_13: # %for.inc.1
# in Loop: Header=BB0_9 Depth=2
addq $6, %rbx
addq $2, %rsi
testl %edi, %edi
movq %rbx, %rdx
jne .LBB0_9
We can see that the decl %edi in LBB0_9 and LBB0_11 could have been merged. The
latter decl %edi is generated in LoopUnroll pass. We need another InstCombine
pass to cleanup some redundency generated in LoopUnroll pass.
With another InstCombine pass added after LoopUnroll, we get:
.LBB0_10: # %for.body3
# Parent Loop BB0_3 Depth=1
# => This Inner Loop Header: Depth=2
cmpb $0, (%rbx)
jne .LBB0_12
# BB#11: # %if.then
# in Loop: Header=BB0_10 Depth=2
movl $0, -10(%rdx)
movw $0, -6(%rdx)
.LBB0_12: # %for.inc
# in Loop: Header=BB0_10 Depth=2
addl $-2, %edi # redundency removed.
cmpb $0, 1(%rbx)
jne .LBB0_14
# BB#13: # %if.then.1
# in Loop: Header=BB0_10 Depth=2
movl $0, -4(%rdx)
movw $0, (%rdx)
.LBB0_14: # %for.inc.1
# in Loop: Header=BB0_10 Depth=2
addq $12, %rdx
addq $2, %rbx
testl %edi, %edi
jne .LBB0_10
--
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/20150514/e56fc6c9/attachment.html>
More information about the llvm-bugs
mailing list