Combine ZExt (B - A) + ZExt(A) to ZExt(B)
https://alive2.llvm.org/ce/z/ESUwPi
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Please pre-commit the baseline tests, so we just show the functional changes from this patch in the tests.
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | ||
---|---|---|
1452 | Use the raw constructor instead of Builder to preserve the value name: return new ZextInst(B, LHS->getType()); | |
llvm/test/Transforms/InstCombine/add.ll | ||
2350 | Add "_commute" to the test name to make the difference clear. | |
2355 | Change types to increase test coverage. You could use weird types like <2 x i5>. | |
2370 | Add another (negative) test where the sub operands are swapped? |
- Use new instead of builder.
- Rename to commute
- Add zext <2 x i5> to <2 x i8> test
- Add zext i2 to i3 test
- Add test that has uses.
- Add negative test of commuted sub operands.
Use the raw constructor instead of Builder to preserve the value name: