| Issue |
56666
|
| Summary |
SimplifySetCC with immediate integer problem
|
| Labels |
|
| Assignees |
|
| Reporter |
Nafeng
|
SimplifySetCC should not combine the setGE into setGT when isLegalICmpImmediate return falseļ¼
this combine would cause generating a imm copy to reg instruction;
```
// IR
%cmp = icmp sge i32 %a, -128
// Debug log print
Combining: t11: i1 = setcc t2, Constant:i32<-128>, setge:ch
Creating constant: t15: i32 = Constant<-129>
Creating new node: t17: i1 = setcc t2, Constant:i32<-129>, setgt:ch
... into: t17: i1 = setcc t2, Constant:i32<-129>, setgt:ch
```
```
// in my TargetLoweringImpl
bool isLegalICmpImmediate(int64_t val) const override {
return val <= 127 && val >= -128;
}
// In SimplifySetCC
if ((DCI.isBeforeLegalizeOps() ||
isCondCodeLegal(NewCC, VT.getSimpleVT())) &&
(!N1C->isOpaque() || (C.getBitWidth() <= 64 &&
isLegalICmpImmediate(C.getSExtValue())))) {
return DAG.getSetCC(dl, VT, N0,
DAG.getConstant(C, dl, N1.getValueType()),
NewCC);
}
```
The root cause is !N1C->isOpaque() is always true;
What's a Opaque Constant? I can not find any Constant was set opaque;
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs