[all-commits] [llvm/llvm-project] 7439d7: [clang][bytecode] Slightly optimize integral casts...

Timm Baeder via All-commits all-commits at lists.llvm.org
Fri May 9 00:02:53 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7439d7bdf5aa0069c91693ec590561f234d05c20
      https://github.com/llvm/llvm-project/commit/7439d7bdf5aa0069c91693ec590561f234d05c20
  Author: Timm Baeder <tbaeder at redhat.com>
  Date:   2025-05-09 (Fri, 09 May 2025)

  Changed paths:
    M clang/lib/AST/ByteCode/Compiler.cpp

  Log Message:
  -----------
  [clang][bytecode] Slightly optimize integral casts of literals (#138879)

We often see initializers like

unsigned a = 10;

which take an integer literal and immediately cast it to another type.
Recognize this pattern and omit the cast, simply emitting the value as a
different type directly.

This reduces the instruction count by up to 0.13%:
http://llvm-compile-time-tracker.com/compare.php?from=303436c6d16518b35288d63a859506ffcc1681e4&to=648f5202f906d1606390b2d1081e4502dc74acc2&stat=instructions:u



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list