[PATCH] D54742: [CodeMetrics] Don't let extends of i1 be free.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 05:21:07 PST 2018


RKSimon added inline comments.


================
Comment at: include/llvm/Analysis/TargetTransformInfoImpl.h:810
 
-    if (const CastInst *CI = dyn_cast<CastInst>(U)) {
-      // Result of a cmp instruction is often extended (to be used by other
-      // cmp instructions, logical or return instructions). These are usually
-      // nop on most sane targets.
-      if (isa<CmpInst>(CI->getOperand(0)))
-        return TTI::TCC_Free;
+    if (const CastInst *CI = dyn_cast<CastInst>(U))
       if (isa<SExtInst>(CI) || isa<ZExtInst>(CI) || isa<FPExtInst>(CI))
----------------
jonpa wrote:
> chandlerc wrote:
> > You don't need this line at all -- the checks below are sufficient.
> OK, moved the cast to the return statement.
Please can you add a comment here that describes the recommended approaches if someone needs to get the old behaviour.


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

https://reviews.llvm.org/D54742





More information about the llvm-commits mailing list