aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InstructionSimplify.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/Analysis/InstructionSimplify.cpp
parentacadc8e0d64e90cded8f63a154ab3111a1d294f9 (diff)
downloadllvm-46e38f36785508dc6f90e642c68e4a72a493e8f5.zip
llvm-46e38f36785508dc6f90e642c68e4a72a493e8f5.tar.gz
llvm-46e38f36785508dc6f90e642c68e4a72a493e8f5.tar.bz2
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/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index b9f9d90a..43dcaec 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -2300,7 +2300,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
} else if (match(LHS, m_SDiv(m_Value(), m_ConstantInt(CI2)))) {
APInt IntMin = APInt::getSignedMinValue(Width);
APInt IntMax = APInt::getSignedMaxValue(Width);
- APInt Val = CI2->getValue();
+ const APInt &Val = CI2->getValue();
if (Val.isAllOnesValue()) {
// 'sdiv x, -1' produces [INT_MIN + 1, INT_MAX]
// where CI2 != -1 and CI2 != 0 and CI2 != 1