[LLVMdev] Why change "sub x, 5" to "add x, -5" ?

Frédéric Heitzmann frederic.heitzmann at gmail.com
Fri Jul 10 00:22:45 PDT 2015


2015-07-08 17:58 GMT+02:00 escha <escha at apple.com>:

> [...]
>
> If you want to “revert" this sort of thing, you can do it at Select() time
> or PreprocessISelDAG(), which is what I did on an out-of-tree backend to
> turn add X, -C into sub X, C on selection time. This still lets all the
> intermediate optimizations take advantage of the canonicalization.
>
> —escha


Unaware of your proposal, I used the TargetLowering::PerformDAGCombine hook.
Is there a reason to prefere PreprocessISelDAG ?

--
Fred
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150710/12e26aab/attachment.html>


More information about the llvm-dev mailing list