[all-commits] [llvm/llvm-project] 783d32: [VirtRegMap] Replace a single value enum with a st...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Sep 17 13:54:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 783d323da3c79d884afaed9b1653697fcac58fe3
      https://github.com/llvm/llvm-project/commit/783d323da3c79d884afaed9b1653697fcac58fe3
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-09-17 (Tue, 17 Sep 2024)

  Changed paths:
    M llvm/include/llvm/CodeGen/VirtRegMap.h

  Log Message:
  -----------
  [VirtRegMap] Replace a single value enum with a static constexpr member variable. NFC (#109010)

Change the constant to INT_MAX instead of our own large number. Any
value larger than a valid frame index should work.

I'm a bit puzzled why it was using a shift of 30. A long time ago when
it was first created, the value was INT_MAX. Then it was changed in
e2b77d57c0c13 to (~0 >> 1) which I guess was trying to be INT_MAX
without using the constant. But ~0 is an `int` so that produced -1.

I'm not sure what the 'l' suffix was for. Unless that was an attempt to
avoid undefined behavior had the shift been 31 instead of 30. But 'long'
is 32 bits on some targets so that wouldn't have worked for all
platforms.

Using INT_MAX is straightforward and avoids any mysteries.



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