[PATCH] D23824: [ADCE] Add handling of PHI nodes when removing control flow
David Callahan via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 16:27:29 PDT 2016
I think your proposed simplification was to always mark the terminators of predecessor blocks of a live PHI as live as well as the reaching definitions. Is that correct?
From: Daniel Berlin <dberlin at dberlin.org<mailto:dberlin at dberlin.org>>
Date: Tuesday, September 6, 2016 at 4:23 PM
To: "reviews+D23824+public+bfd9f3a940dac1be at reviews.llvm.org<mailto:reviews+D23824+public+bfd9f3a940dac1be at reviews.llvm.org>" <reviews+D23824+public+bfd9f3a940dac1be at reviews.llvm.org<mailto:reviews+D23824+public+bfd9f3a940dac1be at reviews.llvm.org>>
Cc: David Callahan <dcallahan at fb.com<mailto:dcallahan at fb.com>>, Tim Amini Golling <mehdi.amini at apple.com<mailto:mehdi.amini at apple.com>>, "nadav.rotem at me.com<mailto:nadav.rotem at me.com>" <nadav.rotem at me.com<mailto:nadav.rotem at me.com>>, David Majnemer <david.majnemer at gmail.com<mailto:david.majnemer at gmail.com>>, Taewook Oh <twoh at fb.com<mailto:twoh at fb.com>>, Kevin Frei <freik at fb.com<mailto:freik at fb.com>>, llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>>
Subject: Re: [PATCH] D23824: [ADCE] Add handling of PHI nodes when removing control flow
Interesting.
I don't see how it legally decides to do that, but okay.
:)
In any case, i still think you should simplify this code unless we have anything that shows the complexity is worth it :)
On Tue, Sep 6, 2016 at 3:55 PM, David Callahan <dcallahan at fb.com<mailto:dcallahan at fb.com>> wrote:
david2050 added a comment.
This snippet
int foo(int b, int j, int N) {
if (b) {
int i;
for (i = 0; i < N; i++)
;
j = 0;
}
return j;
}
via
clang -c -emit-llvm -O0 ...
opt -sroa -adce -adce-remove-loops -S ...
generates
define i32 @foo(i32 %b, i32 %j, i32 %N) #0 {
%1 = icmp ne i32 %b, 0
br i1 %1, label %2, label %3
; <label>:2: ; preds = %0
br label %3
; <label>:3: ; preds = %2, %0
%.0 = phi i32 [ %j, %0 ], [ 0, %2 ]
ret i32 %.0
}
https://reviews.llvm.org/D23824<https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D23824&d=DQMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=lFyiPUrFdOHdaobP7i4hoA&m=2JaRmei7Q_OhLkH0vL2W3_6d3ZborW1k5yIfKnsIK4g&s=T7wb6dqAIu3VNjW8aCi4dLGAwqcdFvlHOr0MXu-H3xU&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160906/8720f26e/attachment.html>
More information about the llvm-commits
mailing list