summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-05-27 00:32:12 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-05-27 00:32:12 +0000
commit9ee054aea8c5d13177bcce85c7aa2ae88e7bfba0 (patch)
treee91d10d5a20183859decaa36867453d54076ca23
parent6816367a272918b44c684a18a59310a5a102d011 (diff)
downloadbcm5719-llvm-9ee054aea8c5d13177bcce85c7aa2ae88e7bfba0.tar.gz
bcm5719-llvm-9ee054aea8c5d13177bcce85c7aa2ae88e7bfba0.zip
ValueMapper: fix typo in minor optimization on constant mapping (NFC)
If every operands of a constant are mapping to themselves, and the type does not change, we have an early exit as acknowledged in the comment: // Otherwise, we have some other constant to remap. Start by checking to see // if all operands have an identity remapping. However instead of checking for identity the code was checking if the operands were mapped to the constant itself, which is rarely true. As a consequence, the coverage report showed that the early exit was never taken. llvm-svn: 270944
-rw-r--r--llvm/lib/Transforms/Utils/ValueMapper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 0e6b6c5ead5..5a48a204973 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -436,7 +436,8 @@ Value *Mapper::mapValue(const Value *V) {
for (; OpNo != NumOperands; ++OpNo) {
Value *Op = C->getOperand(OpNo);
Mapped = mapValue(Op);
- if (Mapped != C) break;
+ if (Mapped != Op)
+ break;
}
// See if the type mapper wants to remap the type as well.
OpenPOWER on IntegriCloud