summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-06-08 10:01:20 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-06-08 10:01:20 +0000
commit46e38f36785508dc6f90e642c68e4a72a493e8f5 (patch)
tree290f0903a81451736d6c920ef4b50bba0e995325 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
parentacadc8e0d64e90cded8f63a154ab3111a1d294f9 (diff)
downloadbcm5719-llvm-46e38f36785508dc6f90e642c68e4a72a493e8f5.tar.gz
bcm5719-llvm-46e38f36785508dc6f90e642c68e4a72a493e8f5.zip
Avoid copies of std::strings and APInt/APFloats where we only read from it
As suggested by clang-tidy's performance-unnecessary-copy-initialization. This can easily hit lifetime issues, so I audited every change and ran the tests under asan, which came back clean. llvm-svn: 272126
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index ecf94dc70a7..69773a57ecb 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -663,8 +663,8 @@ Instruction *InstCombiner::FoldSPFofSPF(Instruction *Inner,
if (SPF1 == SPF2) {
if (ConstantInt *CB = dyn_cast<ConstantInt>(B)) {
if (ConstantInt *CC = dyn_cast<ConstantInt>(C)) {
- APInt ACB = CB->getValue();
- APInt ACC = CC->getValue();
+ const APInt &ACB = CB->getValue();
+ const APInt &ACC = CC->getValue();
// MIN(MIN(A, 23), 97) -> MIN(A, 23)
// MAX(MAX(A, 97), 23) -> MAX(A, 97)
OpenPOWER on IntegriCloud