[PATCH] D48893: [Constants, InstCombine] allow RHS (operand 1) identity constants for binops

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 3 23:22:38 PDT 2018


aqjune added a comment.

I think it depends on what `shl i32 %x, undef` is - undef can be concretized into an integer larger than 31, and according to https://llvm.org/docs/LangRef.html#id134 , it is poison, so conversion like the one in `shuffle_select.ll` may be invalid.
Defining shl with large second operand as poison explains another kind of optimizations, IMHO: For example, InstCombine optimizes `(C2 << X) << C1` into `(C2 << C1) << X`. Defining shl with large shift as `undef` does not explain this optimimzation - If C1 = 4, C2 = 1 and X = 33, source is `(1 << 33) << 4` = `undef << 4` = `(undef with low 4 bits zero)`, but after optimization it is `(1 << 4) << 33` = `undef`. If large shift yields `poison`, this is explained, because `poison << 4` = `poison`.


https://reviews.llvm.org/D48893





More information about the llvm-commits mailing list