[PATCH] D57149: [StackProtector] Skip analysing dead users in HasAddressTaken, PR40436
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 24 22:30:49 PST 2019
uabelho added a comment.
In D57149#1369777 <https://reviews.llvm.org/D57149#1369777>, @rnk wrote:
> An alternative way to handle this would be to remove unreachable code. I'm surprised unreachable code reaches this pass in a normal pipeline. I thought CGP removed it in normal operation, even at O0. However, removing unreachable code might invalidate the domtree (unless our utility for that updates it?).
An alternative that you would prefer?
I have to say that I think it makes sense that StackProtector can deal with the code on it's own since we never know when some dead code might reach StackProtector anyway, but perhaps there are strong reasons CGP really shouldn't leave dead code around?
I don't know CGP, but from the logs I see that it's after CGP that the dead blocks really get disconnected.
Before CGP:
*** IR Dump Before CodeGen Prepare ***
; Function Attrs: sspreq
define void @f1() #0 {
entry:
%d = alloca i16, align 1
br label %for.cond
for.cond: ; preds = %for.cond, %entry
br i1 true, label %for.cond, label %for.end
for.end: ; preds = %for.cond
%tobool = icmp ne i16 undef, 0
br label %for.cond1
for.cond1: ; preds = %for.body2, %for.end
%d2 = phi i16* [ %spec.select, %for.body2 ], [ undef, %for.end ]
br label %for.body2
for.body2: ; preds = %for.cond1
%spec.select = select i1 undef, i16* %d, i16* %d2
br label %for.cond1
}
And then after:
*** IR Dump After CodeGen Prepare ***
; Function Attrs: sspreq
define void @f1() #0 {
entry:
%d = alloca i16, align 1
br label %for.cond
for.cond: ; preds = %for.cond, %entry
br label %for.cond
for.body2: ; preds = %for.body2
%spec.select = select i1 undef, i16* %d, i16* %spec.select
br label %for.body2
}
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57149/new/
https://reviews.llvm.org/D57149
More information about the llvm-commits
mailing list