[lld] [lld][ELF] Fix a corner case of elf::getLoongArchPageDelta (PR #71907)

Xi Ruoyao via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 20:35:05 PST 2023


xry111 wrote:

> We should have a description how the new code does its job and a concise proof as the comment.

The `range(-0x80000, 0x80000)` can be obviously optimized to `[page_low, page_high]` where

```
page_low = ((dest >> 12) - (pc >> 12)) & 0xfffff
page_high = (page_low + 1) & 0xfffff
```

Then the remaining task is proving the "raise Exception("should not be reachable")" line is really unreachable...

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


More information about the llvm-commits mailing list