diff options
author | Andrzej WarzyĆski <andrzej.warzynski@arm.com> | 2025-02-06 09:19:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-06 09:19:18 +0000 |
commit | 78f690bba7846d3e9795bc27a5e27627a4a1ea28 (patch) | |
tree | 1d88eec9909895308e6d70e6c9d8a866cb8ad98e /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | ecb016a87d89aed36b8f5d8102e15d8eb0e57108 (diff) | |
download | llvm-78f690bba7846d3e9795bc27a5e27627a4a1ea28.zip llvm-78f690bba7846d3e9795bc27a5e27627a4a1ea28.tar.gz llvm-78f690bba7846d3e9795bc27a5e27627a4a1ea28.tar.bz2 |
[mlir][Vector] Update VectorEmulateNarrowType.cpp (2/N) (#123527)
This is PR 2 in a series of N patches aimed at improving
"VectorEmulateNarrowType.cpp". This is mainly minor refactoring, no
major functional changes are made/added.
**CHANGE 1**
Renames the variable "scale". Note, "scale" could mean either:
* "container-elements-per-emulated-type", or
* "emulated-elements-per-container-type".
While from the context it is clear that it's always the former (original
type is always a sub-byte type and the emulated type is usually `i8`),
this PR reduces the cognitive load by making this clear.
**CHANGE 2**
Replaces `isUnalignedEmulation` with `isFullyAligned`
Note, `isUnalignedEmulation` is always computed following a
"per-element-alignment" condition:
```cpp
// Check per-element alignment.
if (containerBits % emulatedBits != 0) {
return rewriter.notifyMatchFailure(
op, "impossible to pack emulated elements into container elements "
"(bit-wise misalignment)");
}
// (...)
bool isUnalignedEmulation = origElements % emulatedPerContainerElem != 0;
```
Given that `isUnalignedEmulation` captures only one of two conditions
required for "full alignment", it should be re-named as
`isPartiallyUnalignedEmulation`. Instead, I've flipped the condition and
renamed it as `isFullyAligned`:
```cpp
bool isFullyAligned = origElements % emulatedPerContainerElem == 0;
```
**CHANGE 3**
* Unifies various comments throughout the file (for consistency).
* Adds new comments throughout the file and adds TODOs where high-level
comments are missing.
**GitHub issue to track this work**:
https://github.com/llvm/llvm-project/issues/123630
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions