[JumpThread] Do RAUW in case Cond folds to a constant in the CFG
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
lgtm with nits
| lib/Transforms/Scalar/JumpThreading.cpp | ||
|---|---|---|
| 1252 ↗ | (On Diff #96326) | Separately, it may be better to use DenseMapInfo<BasicBlock *>::getTombStoneKey() here. |
| 1322 ↗ | (On Diff #96326) | I'd structure this as: if (auto *CondInst = dyn_cast<Instruction>(Cond)) {
if (CondInst->use_empty()) {
} else if (OnlyVal && ...) {
}
}Another thing is that this code needs to check !CondInst->mayHaveSideEffects() before removing it. |
| test/Transforms/JumpThreading/fold-not-thread.ll | ||
| 142 ↗ | (On Diff #96326) | Please also add a negative test where %add = add i32 %value, 64 is not in L0. |
| lib/Transforms/Scalar/JumpThreading.cpp | ||
|---|---|---|
| 1322 ↗ | (On Diff #96326) | Good catch with the extra check ! |