[PATCH] D45315: [X86] Improve unsigned saturation downconvert detection.
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 14 07:10:00 PDT 2018
RKSimon added a comment.
Sorry, it took so long to respond!
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:34651
+ Ops[1] = DAG.getConstant(C1, DL, In.getValueType());
+ return DAG.getNode(ISD::SMAX, DL, Ops[0].getValueType(), Ops);
+ }
----------------
RKSimon wrote:
> Not sure what is going on here - why do you need to create a node - it looks like this is just smax again - and there shouldn't be a difference in value types at all?
Sorry I was very unclear (I ended up confusing myself as well) what I meant was that everything should be the same value type already and C1 was already a node at In.getOperand(1), so you should be able to do something like:
```
EVT InVT = In.getValueType();
return DAG.getNode(ISD::SMAX, DL, InVT, SMin, In.getOperand(1));
```
It might even be worth pulling out the InVT to the top of the function so you can use it in the assert as well.
Repository:
rL LLVM
https://reviews.llvm.org/D45315
More information about the llvm-commits
mailing list