| commit | 587d6fcbb685e3a57803110695a1996ac895d8b8 | [log] [tgz] |
|---|---|---|
| author | Han-Chung Wang <hanhan0912@gmail.com> | Thu May 29 19:18:14 2025 -0700 |
| committer | GitHub <noreply@github.com> | Thu May 29 19:18:14 2025 -0700 |
| tree | 767ace5243a9071a34cb653525d1193491f25df0 | |
| parent | 65c127f4c6b0da0e9bf1d49fc79fce9074e95264 [diff] |
[mlir] Recover the behavior of SliceAnaylsis for llvm-project@6a8dde04a07 (#142076) In https://github.com/llvm/llvm-project/commit/6a8dde04a07287f837bbabeb93e23e47af366d3d, it changes the method to return LogicalFailure, so callers can handle the failure instead of crashing, if I read the intention correctly. However, it changes the behavior of the implementation; it breaks several integratino tests in downstream projects (e.g., IREE). Before the change, processValue does not treat it as a failure if the check below TODO has a false condition. However, with the new change, it starts treating it as a failure. The revision updates the final `else` branch (i.e., `llvm_unreachable` line) to return a failure, and return success at the end; the behavior is recovered. ```cpp auto processValue = [&](Value value) { if (auto *definingOp = value.getDefiningOp()) { if (backwardSlice->count(definingOp) == 0) getBackwardSliceImpl(definingOp, backwardSlice, options); } else if (auto blockArg = dyn_cast<BlockArgument>(value)) { if (options.omitBlockArguments) return; Block *block = blockArg.getOwner(); Operation *parentOp = block->getParentOp(); // TODO: determine whether we want to recurse backward into the other // blocks of parentOp, which are not technically backward unless they flow // into us. For now, just bail. if (parentOp && backwardSlice->count(parentOp) == 0) { assert(parentOp->getNumRegions() == 1 && llvm::hasSingleElement(parentOp->getRegion(0).getBlocks())); getBackwardSliceImpl(parentOp, backwardSlice, options); } } else { llvm_unreachable("No definingOp and not a block argument."); } ``` No additional tests are added, like the previous commit. This revision is mostly a post-fix for https://github.com/llvm/llvm-project/commit/6a8dde04a07287f837bbabeb93e23e47af366d3d Co-authored-by: Ian Wood <ianwood2024@u.northwestern.edu> Signed-off-by: hanhanW <hanhan0912@gmail.com>
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.