[PATCH] Select Elimination in InstCombine

Gerolf Hoflehner ghoflehner at apple.com
Fri Sep 12 13:30:22 PDT 2014


On Sep 11, 2014, at 3:46 PM, David Majnemer <david.majnemer at gmail.com> wrote:

> ================
> Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2953-2954
> @@ +2952,4 @@
> +            unsigned ReplaceWithOpd = 0;
> +            if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(Op2))
> +              if (CI->getValue().getBoolValue())
> +                // Example:
> ----------------
> I think this reads easier as: `!CI->isZero()`
> 
> Speaking of which, why is it bad if the constant is zero?
The constant in the select and compare have to be equal for this transformation to be valid. I’ll add a comment to the example.
> 
> http://reviews.llvm.org/D5258
> 
> 





More information about the llvm-commits mailing list