Issue 97390
Summary [RISCV] Node returned by foldBinOpIntoSelectIfProfitable reports error in lowerSELECT
Labels new issue
Assignees Yunzezhu94
Reporter Yunzezhu94
    Here is a simple reduced case:
`int a = (a ? 4 : 8) / (8 ? -5141143369814759789L : 0);`
When compiling this case with order 
`clang++  -std=c++11 -march=rv64imafdc -mabi=lp64d -w -O0 -o a.o -c a.cpp`
It reports error: llvm-project/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:960: const llvm::SDValue& llvm::SDNode::getOperand(unsigned int) const: Assertion `Num < NumOperands && "Invalid child # of SDNode!"' failed.

It is because for certain cases foldBinOpIntoSelectIfProfitable may return a constant node when trueVal and falseVal of the select inst have the same value, at this time in following lowerSELECT it reports error that operands cannot be get from a constant node.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to