[llvm-commits] [PATCH] PR4895: Missed phi/phi/select folding opportunity

Eli Friedman eli.friedman at gmail.com
Sat Sep 5 01:23:38 PDT 2009


On Fri, Sep 4, 2009 at 10:58 PM, Daniel Dunbar<daniel at zuster.org> wrote:
> Is resolving undef comparisons arbitrarily the "right" way?

I assume the question is about the following bit of the patch?

+      if (Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i))) {
+        if (InC == ConstantInt::getTrue(InC->getContext()))
+          InV = SI->getTrueValue();
+        else
+          InV = SI->getFalseValue();

Folding undef arbitrarily is okay, but this code doesn't handle i1
constant expressions correctly.

-Eli



More information about the llvm-commits mailing list