aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/VirtualFileSystemTest.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-12-16 09:45:36 +0100
committerNikita Popov <npopov@redhat.com>2022-12-16 16:01:25 +0100
commit379de1239ee3eb17ca37035c069afcc1d5e04d27 (patch)
tree0f963b782f6901fd2791634951f6a098a8c8071b /llvm/unittests/Support/VirtualFileSystemTest.cpp
parentcb3f415cd2019df7d14683842198bc4b7a492bc5 (diff)
downloadllvm-379de1239ee3eb17ca37035c069afcc1d5e04d27.zip
llvm-379de1239ee3eb17ca37035c069afcc1d5e04d27.tar.gz
llvm-379de1239ee3eb17ca37035c069afcc1d5e04d27.tar.bz2
[InstCombine] Preserve instruction name in replaceInstUsesWith()
Currently InstCombine folds using the `return replaceInstUsesWith(V, Builder.CreateFoo())` pattern do not preserve the original name of the instruction. To preserve the name, you either have to use something like `return FooInst::Create(...)` which is usually less nice, or go out of the way to preserve the name with takeName(). We often don't do that. This patch instead preserves the name in replaceInstUsesWith() when replacing a named instruction with an unnamed instruction. To be conservative, I also added a zero-use check, which is a proxy for the case where the instruction was just created, rather than an existing one reused. Possibly we could drop that part. As InstCombine tests are robust against renames this does not cause any test diffs, so I regenerated a random test to show the effects. Differential Revision: https://reviews.llvm.org/D140192
Diffstat (limited to 'llvm/unittests/Support/VirtualFileSystemTest.cpp')
0 files changed, 0 insertions, 0 deletions