[LLVMdev] Potential SimplifyCFG optimization; hammock to diamond transformation
Chad Rosier
chad.rosier at gmail.com
Tue Aug 6 08:18:08 PDT 2013
The specific code I'm looking at does not have any function calls. The
"lots of FP math" is just a series of FP addition, subtraction and division.
On Tue, Aug 6, 2013 at 11:03 AM, David Tweed <david.tweed at arm.com> wrote:
> Hi,****
>
> ** **
>
> I imagine this optimization is for FP math stuff that doesn't involve
> functions which might set errno (or when we've specified we don't care
> about that)?****
>
> ** **
>
> Cheers,
> Dave****
>
> ** **
>
> *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On
> Behalf Of *Chad Rosier
> *Sent:* 06 August 2013 15:46
> *To:* llvmdev
> *Subject:* [LLVMdev] Potential SimplifyCFG optimization; hammock to
> diamond transformation****
>
> ** **
>
> All,
> I have some code that looks like the following:
>
> {
> double a, b, c;
> for (...) {
> ...
> a = lots of FP math;
> b = lots of FP math;
> c = lots of FP math;
> if (cond) {
> a = 0.0;
> b = 0.1;
> c = 0.2;
> }
> ...
> }
> }
>
> Could we not convert the hammock into a diamond and move the initial
> computation of a, b, and c into the else block. Something like this:
>
> {
> double a, b, c;
> for (...) {
> ...
> if (cond) {
> a = 0.0;
> b = 0.1;
> c = 0.2;
> } else {
> a = lots of FP math;
> b = lots of FP math;
> c = lots of FP math;
> }
> ...
> }
> }
>
> Does a similar optimization exist? If not, would the SimplifyCFG pass be
> an appropriate home for such an optimization?
>
> Chad****
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130806/7a829051/attachment.html>
More information about the llvm-dev
mailing list