[PATCH] D23134: Make cltz and cttz zero undef when the operand cannot be zero in InstCombine
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 07:19:41 PDT 2016
spatel added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:1283-1296
@@ -1268,16 +1282,16 @@
/// CallInst simplification. This mostly only handles folding of intrinsic
/// instructions. For normal calls, it allows visitCallSite to do the heavy
/// lifting.
Instruction *InstCombiner::visitCallInst(CallInst &CI) {
auto Args = CI.arg_operands();
if (Value *V = SimplifyCall(CI.getCalledValue(), Args.begin(), Args.end(), DL,
&TLI, &DT, &AC))
return replaceInstUsesWith(CI, V);
if (isFreeCall(&CI, &TLI))
return visitFree(CI);
// If the caller function is nounwind, mark the call as nounwind, even if the
// callee isn't.
if (CI.getParent()->getParent()->doesNotThrow() &&
----------------
Sorry for still not seeing it...can you add test case to show the difference?
AFAICT, the undef param of these intrinsics must be an i1 true/false constant?
case Intrinsic::ctlz: // llvm.ctlz
case Intrinsic::cttz: // llvm.cttz
Assert(isa<ConstantInt>(CS.getArgOperand(1)),
"is_zero_undef argument of bit counting intrinsics must be a "
"constant int",
CS);
https://reviews.llvm.org/D23134
More information about the llvm-commits
mailing list