[PATCH] D58881: [Transform] Improve fold of sadd.with.overflow
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 4 00:41:17 PST 2019
nikic added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/call-add-with-overflow.ll:58
+ %2 = add nsw <2 x i32> %0, <i32 12, i32 undef>
+ %3 = tail call { <2 x i32>, <2 x i1> } @llvm.sadd.with.overflow.v2i32(<2 x i32> %2, <2 x i32> <i32 30, i32 30>)
+ ret { <2 x i32>, <2 x i1> } %3
----------------
dlrobertson wrote:
> Note: this did not fold.
Ooops, my bad. I was under the impression that m_APInt ignores undefs, but apparently only matchers for specific constants like m_Zero() do that. Something we might want to improve.
================
Comment at: llvm/test/Transforms/InstCombine/call-add-with-overflow.ll:71
+ ret { <2 x i32>, <2 x i1> } %4
+}
----------------
One more test that would be good to have is a negative test for add (without nsw) with sadd. Could also have add nuw (no fold) and add nuw nsw (fold) variants to be thorough.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58881/new/
https://reviews.llvm.org/D58881
More information about the llvm-commits
mailing list