[PATCH] D75801: [InstCombine] Remove known bits constant folding

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 20 05:23:34 PDT 2020


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: test/Analysis/ValueTracking/known-signbit-shift.ll:46
+; CHECK-NEXT:    [[SEL:%.*]] = select i1 [[B:%.*]], i32 2147221504, i32 2146959360
+; CHECK-NEXT:    ret i32 [[SEL]]
 ;
----------------
lebedev.ri wrote:
> nikic wrote:
> > I missed these Analysis test changes before. The shl here is poison because we know it wraps based on known bits. This optimization gets lost now.
> > 
> > I could add it back explicitly (and better, by returning undef rather than zero) like this: https://gist.github.com/nikic/29135f304f7cf9de6d18dff7ca12659a
> > 
> > I'm not sure whether that's worthwhile though, it seems that these tests are more about not crashing due to conflicting known bits than anything else.
> This still seems like worthwhile fold.
I've opened D76489 to address the reason why this difference exists in the first place (SimplifyDemanded produces a less good known bits result). We could still do a better overflow detection on top of that, but at least this removes the gap to what we currently do.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75801/new/

https://reviews.llvm.org/D75801





More information about the llvm-commits mailing list