[PATCH] D45448: [CVP] simplify phi with constant incoming values that match common variable edge values
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 11:26:25 PDT 2018
spatel created this revision.
spatel added reviewers: sanjoy, jlebar, efriedma.
Herald added a subscriber: mcrosier.
This is based on an example that was recently posted on llvm-dev:
void *propagate_null(void* b, int* g) {
if (!b) {
return 0;
}
(*g)++;
return b;
}
https://godbolt.org/g/xYk3qG
The original code or constant propagation in other passes has obscured the fact that the phi can be removed completely.
There's an instcombine proposal to fix part of this at https://reviews.llvm.org/D45378, but I don't think we want instcombine doing things like that (and I'm not sure that patch is correct as-is).
https://reviews.llvm.org/D45448
Files:
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
test/Transforms/CorrelatedValuePropagation/phi-common-val.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45448.141690.patch
Type: text/x-patch
Size: 5963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180409/e6b3ebca/attachment-0001.bin>
More information about the llvm-commits
mailing list