From 9ee054aea8c5d13177bcce85c7aa2ae88e7bfba0 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Fri, 27 May 2016 00:32:12 +0000 Subject: 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 --- llvm/lib/Transforms/Utils/ValueMapper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms') 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. -- cgit v1.2.3