[all-commits] [llvm/llvm-project] fcde4f: [mlir][Transforms][NFC] Dialect Conversion: Remove...

Matthias Springer via All-commits all-commits at lists.llvm.org
Sat Sep 28 11:10:07 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fcde4f6577697042cec1be4f8fbacc7bf483954c
      https://github.com/llvm/llvm-project/commit/fcde4f6577697042cec1be4f8fbacc7bf483954c
  Author: Matthias Springer <me at m-sp.org>
  Date:   2024-09-28 (Sat, 28 Sep 2024)

  Changed paths:
    M mlir/lib/Transforms/Utils/DialectConversion.cpp

  Log Message:
  -----------
  [mlir][Transforms][NFC] Dialect Conversion: Remove redundant `lookupOrDefault` (#110370)

Remove a redundant `lookupOrDefault` that has no effect.

When no type is passed to `lookupOrDefault`, that function returns the
furthest mapped value (by following the mapping iteratively). If there
is no mapped value with the desired type, then the function also returns
the furthest mapped value.

The value that was passed to the redundant `lookupOrDefault` was
produced by this code:
```
Value newOperand = mapping.lookupOrDefault(operand, desiredType);
```

There are 2 possible cases:
- Case 1: There is no mapping to `desiredType`. Then `newOperand` is the
furthest mapped value.
- Case 2: There is a mapping to `desiredType`. Then the type of
`newOperand` is `desiredType` and the "if" branch that encloses the
redundant `lookupOrDefault` is not executed at all.

Also improve the documentation of
`ConversionValueMapping::lookupOrDefault` and simplify the
implementation a bit.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list