%a = sub i32 31, %x %r = shl i32 1, %a => %d = shl i32 1, 31 %r = lshr i32 %d, %x Done: 1 Optimization is correct!
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/InstCombine/InstCombineShifts.cpp | ||
---|---|---|
677 ↗ | (On Diff #206005) | Or maybe even simpler, use match(Op0, m_One()). |
Comment Actions
Please precommit those 3 extra tests first though
test/Transforms/InstCombine/shl-sub.ll | ||
---|---|---|
56 ↗ | (On Diff #206010) | missing 3 tests with undef: define <3 x i64> @shl_sub_i64_vec_undef0(<3 x i64> %x) { %s = sub <3 x i64> <i64 63, i64 undef, i64 63>, %x %r = shl <3 x i64> <i64 1, i64 1, i64 1>, %s ret <3 x i64> %r } define <3 x i64> @shl_sub_i64_vec_undef1(<3 x i64> %x) { %s = sub <3 x i64> <i64 63, undef, i64 63>, %x %r = shl <3 x i64> <i64 1, i64 undef, i64 1>, %s ret <3 x i64> %r } define <3 x i64> @shl_sub_i64_vec_undef2(<3 x i64> %x) { %s = sub <3 x i64> <i64 63, i64 undef, i64 63>, %x %r = shl <3 x i64> <i64 1, i64 undef, i64 1>, %s ret <3 x i64> %r } |