1. [TargetLowering] Strip tailing whitespace (NFC) (details)
  2. [EarlyCSE] add tests for commutative intrinsics; NFC (details)
  3. [EarlyCSE] fold commutable intrinsics (details)
Commit 51d34c0c5357eef2c8b1cf0311a075200f16bb27 by nikita.ppv
[TargetLowering] Strip tailing whitespace (NFC)
The file was modifiedllvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp (diff)
Commit f90d73eab6e550788634d70ec2ca6391648cb540 by spatel
[EarlyCSE] add tests for commutative intrinsics; NFC
The file was modifiedllvm/test/Transforms/EarlyCSE/commute.ll (diff)
Commit 096527214033772e8d80fdefd8a018b9bfa20021 by spatel
[EarlyCSE] fold commutable intrinsics

Handling the new min/max intrinsics is the motivation, but it
turns out that we have a bunch of other intrinsics with this
missing bit of analysis too.

The FP min/max tests show that we are intersecting FMF,
so that part should be safe too.

As noted in , there is a commutative
property specifier for intrinsics, but no corresponding function
attribute, and so apparently no uses of that bit. We may want to
remove that next.

Follow-up patches should wire up the Instruction::isCommutative()
to this IntrinsicInst specialization. That requires updating
callers to be aware of the more general commutative property
(not just binops).

Differential Revision:
The file was modifiedllvm/lib/Transforms/Scalar/EarlyCSE.cpp (diff)
The file was modifiedllvm/include/llvm/IR/IntrinsicInst.h (diff)
The file was modifiedllvm/test/Transforms/EarlyCSE/commute.ll (diff)