[PATCH] D36234: [InstCombine] Support sext in foldLogicCastConstant
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 12:02:13 PDT 2017
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM. I think it makes sense for the same reason as the zext case.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1092
// Move the logic operation ahead of a zext if the constant is unchanged in
// the smaller source type. Performing the logic in a smaller type may provide
----------------
Update comment to 'zext or sext'.
================
Comment at: test/Transforms/InstCombine/cast.ll:591-592
+; CHECK-NEXT: [[TMP1:%.*]] = or i8 [[A:%.*]], 42
+; CHECK-NEXT: [[C:%.*]] = sext i8 [[TMP1]] to i64
+; CHECK-NEXT: [[E:%.*]] = and i64 [[C]], 4294967295
; CHECK-NEXT: ret i64 [[E]]
----------------
Not this patch, but seems odd that we'd choose to sext to the larger type and mask rather than sext+zext?
https://reviews.llvm.org/D36234
More information about the llvm-commits
mailing list