[all-commits] [llvm/llvm-project] 535197: [PredicateInfo] Reformat PT_Switch's annotation as...
Kunqiu Chen via All-commits
all-commits at lists.llvm.org
Mon Oct 27 08:45:23 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 535197fcef35be44f6da37eaf852ef9a09873f43
https://github.com/llvm/llvm-project/commit/535197fcef35be44f6da37eaf852ef9a09873f43
Author: Kunqiu Chen <camsyn at foxmail.com>
Date: 2025-10-27 (Mon, 27 Oct 2025)
Changed paths:
M llvm/lib/Transforms/Utils/PredicateInfo.cpp
M llvm/test/Transforms/Util/PredicateInfo/condprop.ll
Log Message:
-----------
[PredicateInfo] Reformat PT_Switch's annotation as valid comments (#165249)
Previously, PredicateInfo brutally annotated `PT_Switch` as follows:
```python
f'"; switch predicate info ... CaseValue: ... Switch: {*PS->Switch} Edge: ... RenamedOp: ..."'
```
However, the `switch` instruction in LLVM might cross >1 lines, leading
to the annotation of `PT_Switch` being **illegal comments**, e.g.,
```LLVM
; switch predicate info { CaseValue: i32 1 Switch: switch i32 %x, label %default [
i32 0, label %case0
i32 1, label %case1
i32 2, label %case0
i32 3, label %case3
i32 4, label %default
] Edge: [label %sw,label %case1], RenamedOp: %x }
x.0 = bitcast i32 %x to i32
```
This patch removes the `switch` printing, reformating the `PT_Switch`'s
annotation as follows:
```python
f'"; switch predicate info ... CaseValue: ... Edge: ... RenamedOp: ..."'
```
, e.g.,
```LLVM
; switch predicate info { CaseValue: i32 1 Edge: [label %sw,label %case1], RenamedOp: %x }
x.0 = bitcast i32 %x to i32
```
It should be Okay because `CaseValue: ...` + `Edge: ...` are meaningful
enough for diagnostics, covering the necessary info provided by full
switch printing (E.g., `PT_Branch` also did not print the relevant
branch instruction).
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