[PATCH] D46760: [InstCombine] Enhance narrowUDivURem.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 11 10:59:12 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:948
+
+  if (CanConvert) {
     // If the constant is the same in the smaller type, use the narrow version.
----------------
bixia wrote:
> lebedev.ri wrote:
> > I'd guess it would be simpler to use early return.
> I don't quite understand how to do that without duplication the code inside if (CanConvert)? Can you some detail?
Now, it's 
```
if (CanConvert) {
  ...
  return new ...;
}

return nullptr;
```
i'd think you can just do 
```
if (!CanConvert)
  return nullptr;
....
return new ...;

```


Repository:
  rL LLVM

https://reviews.llvm.org/D46760





More information about the llvm-commits mailing list