Tingyuan LIANG via llvm-dev
2019-Apr-15 18:20 UTC
[llvm-dev] Loop Strength Reduction Pass Does Not Work for Some Varialbles Related to Induction Variables
Dear Momchil, Thanks a lot for your prompt reply and kindly suggestion. The code will truly lead to some automatic unrolling with GCC and increase the number of operations in the assembly code. However, I am focus on the the IR optimization and the calculation of the array element offest, which may need multiplication if the IR instruction GEP is lowered to arithmetic operations. The multiplication operations should be able to be removed by using the LLVM Pass LoopStrengthReduction. Interestingly, it does not work for the test code. I wamt to post the IR code but it might be too long to be in the mail. Thanks again for your time and precious suggestions! Best regards, ------------------------------------------ Tingyuan LIANG MPhil Student Department of Electronic and Computer Engineering The Hong Kong University of Science and Technology 发件人: Momchil Velikov 发送时间: 4月16日星期二 01:13 主题: Re: [llvm-dev] Loop Strength Reduction Pass Does Not Work for Some Varialbles Related to Induction Variables 收件人: Tingyuan LIANG 抄送: llvm-dev at lists.llvm.org From a quick glance at the code, it looks like both inner loops were unrolled at least once (vary by architecture) and have the expected number of multiplications, four and two (if unrolled once), respectively. https://gcc.godbolt.org/z/1ks4Pt -- Momchil Velikov, Senior Compiler Engineer Arm -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190415/1bc260bd/attachment.html>
Momchil Velikov via llvm-dev
2019-Apr-15 18:40 UTC
[llvm-dev] Loop Strength Reduction Pass Does Not Work for Some Varialbles Related to Induction Variables
Some multiplications, used in address calculation, may stay after loop strength reduction, if the target machine has scaled index addressing mode. -- Momchil Velikov, Senior Compiler Engineer Arm -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190415/279e1113/attachment.html>
Tingyuan LIANG via llvm-dev
2019-Apr-17 13:41 UTC
[llvm-dev] Loop Strength Reduction Pass Does Not Work for Some Varialbles Related to Induction Variables
Dear Momchil, Thanks a lot for your detailed information and yes, it seems that loop strength reduction is limited by scaled index addressing mode. Now, I implement a simple LSR pass to do LSR aggressively, ignoring the scaled addressing mode. Thanks again for you time and suggestions! Best regards, ------------------------------------------ Tingyuan LIANG MPhil Student Department of Electronic and Computer Engineering The Hong Kong University of Science and Technology ________________________________ From: Momchil Velikov <momchil.velikov at gmail.com> Sent: Tuesday, April 16, 2019 2:40 AM To: Tingyuan LIANG Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] Loop Strength Reduction Pass Does Not Work for Some Varialbles Related to Induction Variables Some multiplications, used in address calculation, may stay after loop strength reduction, if the target machine has scaled index addressing mode. -- Momchil Velikov, Senior Compiler Engineer Arm -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190417/32f13f2a/attachment.html>