[llvm] r202103 - [SROA] Use a more direct way of determining whether we are processing
Chandler Carruth
chandlerc at gmail.com
Mon Feb 24 19:50:14 PST 2014
Author: chandlerc
Date: Mon Feb 24 21:50:14 2014
New Revision: 202103
URL: http://llvm.org/viewvc/llvm-project?rev=202103&view=rev
Log:
[SROA] Use a more direct way of determining whether we are processing
the destination operand or source operand of a memmove.
It so happens that it was impossible for SROA to try to rewrite
self-memmove where the operands are *identical*, because either such
a think is volatile (and we don't rewrite) or it is non-volatile, and we
don't even register it as a use of the alloca.
However, making the 'IsDest' test *rely* on this subtle fact is... Very
confusing for the reader. We should use the direct and readily available
test of the Use* which gives us concrete information about which operand
is being rewritten.
No functionality changed, I hope! ;]
Modified:
llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=202103&r1=202102&r2=202103&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Mon Feb 24 21:50:14 2014
@@ -2428,8 +2428,9 @@ private:
uint64_t NewBeginOffset = std::max(BeginOffset, NewAllocaBeginOffset);
uint64_t NewEndOffset = std::min(EndOffset, NewAllocaEndOffset);
- assert(II.getRawSource() == OldPtr || II.getRawDest() == OldPtr);
- bool IsDest = II.getRawDest() == OldPtr;
+ bool IsDest = &II.getRawDestUse() == OldUse;
+ assert(IsDest && II.getRawDest() == OldPtr ||
+ (!IsDest && II.getRawSource() == OldPtr));
// Compute the relative offset within the transfer.
unsigned IntPtrWidth = DL.getPointerSizeInBits();
More information about the llvm-commits
mailing list