[PATCH] D42424: [InstCombine] Allow common type conversions to i8/i16

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 10:33:20 PST 2018


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/select-bitext.ll:117
+; CHECK-NEXT:    [[SEXT:%.*]] = shl i32 [[TRUNC]], 16
+; CHECK-NEXT:    [[TMP1:%.*]] = ashr exact i32 [[SEXT]], 16
 ; CHECK-NEXT:    [[EXT:%.*]] = select i1 %cmp, i32 [[TMP1]], i32 42
----------------
dmgreen wrote:
> Although longer, this produced the same final assembly as the old function on any target I tried.
We canonicalize trunc+sext to shifts, and we have a similar fold for:
    // ashr (shl (zext X), C), C --> sext X
...so I think we can add a fold for this too (guarded by shouldChangeType).

https://rise4fun.com/Alive/NVU

I'll post that for review, so we can eliminate this sequence as a potential cause of regressions.


https://reviews.llvm.org/D42424





More information about the llvm-commits mailing list