[PATCH] D47980: [InstCombine] Fold (x << y) >> y -> x & (-1 >> y)
Nicolai Hähnle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 11 02:59:48 PDT 2018
nhaehnle added inline comments.
================
Comment at: test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll:898-899
; CHECK-NEXT: %1 = sub i32 32, %width
-; CHECK-NEXT: %2 = shl i32 %src, %1
-; CHECK-NEXT: %bfe = lshr i32 %2, %1
+; CHECK-NEXT: %2 = lshr i32 -1, %1
+; CHECK-NEXT: %bfe = and i32 %2, %src
; CHECK-NEXT: ret i32 %bfe
----------------
Indeed, the pattern matching in the backend does not recognize this and ends up generating worse code.
Repository:
rL LLVM
https://reviews.llvm.org/D47980
More information about the llvm-commits
mailing list