aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.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/IR/Verifier.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/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 2c9b121..1deb3b9 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -3663,7 +3663,7 @@ void Verifier::visitInstruction(Instruction &I) {
Assert(MD->getNumOperands() == 1, "fpmath takes one operand!", &I);
if (ConstantFP *CFP0 =
mdconst::dyn_extract_or_null<ConstantFP>(MD->getOperand(0))) {
- APFloat Accuracy = CFP0->getValueAPF();
+ const APFloat &Accuracy = CFP0->getValueAPF();
Assert(Accuracy.isFiniteNonZero() && !Accuracy.isNegative(),
"fpmath accuracy not a positive number!", &I);
} else {