Add constant folder for left shift
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
|---|---|---|
| 1859 | We should likely check here that the shift is valid before trying to fold. | |
| mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
|---|---|---|
| 1859 | Valid in what sense? Doesn't ShLIOp have the semantic of other left shifts that top bits shifted off are discarded? | |
| mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp | ||
|---|---|---|
| 1859 | I assume (though it isn't documented) that the behavior is similar to LLVM in that shifting by amounts larger than the integer width is undefined: https://llvm.org/docs/LangRef.html#id150 There are also questions about wrapping behavior, but we don't model those things at this point. | |
We should likely check here that the shift is valid before trying to fold.