[PATCH] D99648: [GVN] Refactor analyzeLoadFromClobberingWrite to simplify code
ksyx via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 31 03:43:34 PDT 2021
ksyx created this revision.
ksyx added reviewers: lattner, dberlin.
Herald added a subscriber: hiraditya.
ksyx requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This change adjusts the order of two swappable if statements to make code cleaner.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99648
Files:
llvm/lib/Transforms/Utils/VNCoercion.cpp
Index: llvm/lib/Transforms/Utils/VNCoercion.cpp
===================================================================
--- llvm/lib/Transforms/Utils/VNCoercion.cpp
+++ llvm/lib/Transforms/Utils/VNCoercion.cpp
@@ -204,15 +204,6 @@
uint64_t StoreSize = WriteSizeInBits / 8; // Convert to bytes.
LoadSize /= 8;
- bool isAAFailure = false;
- if (StoreOffset < LoadOffset)
- isAAFailure = StoreOffset + int64_t(StoreSize) <= LoadOffset;
- else
- isAAFailure = LoadOffset + int64_t(LoadSize) <= StoreOffset;
-
- if (isAAFailure)
- return -1;
-
// If the Load isn't completely contained within the stored bits, we don't
// have all the bits to feed it. We could do something crazy in the future
// (issue a smaller load then merge the bits in) but this seems unlikely to be
@@ -221,6 +212,10 @@
StoreOffset + StoreSize < LoadOffset + LoadSize)
return -1;
+ // The if statement above ensures StoreOffset <= LoadOffset
+ if (StoreOffset + int64_t(StoreSize) <= LoadOffset)
+ return -1;
+
// Okay, we can do this transformation. Return the number of bytes into the
// store that the load is.
return LoadOffset - StoreOffset;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99648.334400.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210331/e7be9ef8/attachment.bin>
More information about the llvm-commits
mailing list