[llvm] [NVPTX] Implement isTruncateFree and isZExtFree for i32/i64 Optimizations (PR #114683)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 11:21:49 PST 2024


================
@@ -3340,6 +3340,23 @@ bool NVPTXTargetLowering::splitValueIntoRegisterParts(
   return false;
 }
 
+bool llvm::NVPTXTargetLowering::isTruncateFree(EVT FromVT, EVT ToVT) const {
+  if (FromVT.isVector() || ToVT.isVector() || !FromVT.isInteger() ||
+      !ToVT.isInteger()) {
----------------
Artem-B wrote:

Style nit. LLVM prefers no braces around single-statement bodies.
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

Also, my personal nit: I prefer minimizing the number of negations. `.. || !(FromVT.isInteger() && ToVT.isInteger()) ` is, IMO, better at conveying the intent ( as in "we want both to be integers") instead of eliminating unwanted parts piecemeal.


https://github.com/llvm/llvm-project/pull/114683


More information about the llvm-commits mailing list