[llvm-dev] Intrinsic opt failure
Konstantin Vladimirov via llvm-dev
llvm-dev at lists.llvm.org
Tue Feb 16 06:44:37 PST 2016
Hi,
Working on private backend, based on llvm-3.7
Inside lib/Transforms/InstCombine/InstCombineCompares.cpp there is
attempt to optimize fabs:
if (F->getIntrinsicID() == Intrinsic::fabs ||
...
switch (I.getPredicate()) {
...
case FCmpInst::FCMP_OGT:
return new FCmpInst(FCmpInst::FCMP_ONE, CI->getArgOperand(0), RHSC);
But
CI->getArgOperand(0) returns operand with type (double*) rather then
double, because in our ABI doubles are passed via memory.
Next assertion fires inside FCmpInst ctor:
llvm::FCmpInst::FCmpInst(llvm::CmpInst::Predicate, llvm::Value*,
llvm::Value*, const llvm::Twine&): Assertion `getOperand(0)->getType()
== getOperand(1)->getType() && "Both operands to FCmp instruction are
not of the same type!"' failed.
I think, here required some check that CI->getArgOperand returns
correct value before trying to optimize.
What would you advise?
---
With best regards, Konstantin
More information about the llvm-dev
mailing list