[llvm] [InstCombine] Fold `sext(trunc nsw)` and `zext(trunc nuw)` (PR #88609)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 13 04:15:08 PDT 2024
================
@@ -1188,9 +1188,20 @@ Instruction *InstCombinerImpl::visitZExt(ZExtInst &Zext) {
if (auto *CSrc = dyn_cast<TruncInst>(Src)) { // A->B->C cast
// TODO: Subsume this into EvaluateInDifferentType.
+ Value *A = CSrc->getOperand(0);
+ // If TRUNC has nuw flag, then convert directly to final type.
----------------
nikic wrote:
TRUNC -> trunc
https://github.com/llvm/llvm-project/pull/88609
More information about the llvm-commits
mailing list