Small refactor on VectorizerHint for deduplication
authorRenato Golin <renato.golin@linaro.org>
Mon, 1 Sep 2014 10:00:17 +0000 (10:00 +0000)
committerRenato Golin <renato.golin@linaro.org>
Mon, 1 Sep 2014 10:00:17 +0000 (10:00 +0000)
commit35b114fe182430dcb42df5d21ae9a28993ee46d6
tree9a1664c8f108c0cd678c5d674b4caa4701475ecd
parent895aa397038b8de86d83ac0997a70949a486e112
Small refactor on VectorizerHint for deduplication

Previously, the hint mechanism relied on clean up passes to remove redundant
metadata, which still showed up if running opt at low levels of optimization.
That also has shown that multiple nodes of the same type, but with different
values could still coexist, even if temporary, and cause confusion if the
next pass got the wrong value.

This patch makes sure that, if metadata already exists in a loop, the hint
mechanism will never append a new node, but always replace the existing one.
It also enhances the algorithm to cope with more metadata types in the future
by just adding a new type, not a lot of code.

Re-applying again due to MSVC 2013 being minimum requirement, and this patch
having C++11 that MSVC 2012 didn't support.

Fixes PR20655.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216870 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/duplicated-metadata.ll [new file with mode: 0644]