[all-commits] [llvm/llvm-project] d37a31: [X86] Attempt to fix ubsan failure.

Craig Topper via All-commits all-commits at lists.llvm.org
Fri Feb 10 10:03:10 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d37a31cf237cb4f8a18b12c91a9204feca5900ef
      https://github.com/llvm/llvm-project/commit/d37a31cf237cb4f8a18b12c91a9204feca5900ef
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-02-10 (Fri, 10 Feb 2023)

  Changed paths:
    M llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp

  Log Message:
  -----------
  [X86] Attempt to fix ubsan failure.

operator~ promote the single bit input to int. The ~ will cause the upper
31 bits to become 1s making it a negative value. This is undefined for
shift.

Mask it back down to a single bit.

The extra 1s were being shifted to bit 8 and above and the they aren't
used by the emitByte call so this shouldn't be a functional change.




More information about the All-commits mailing list