[llvm] [PredicateInfo] Support select instructions (PR #229613)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 02:24:16 PDT 2026
================
@@ -42,3 +42,131 @@ define i1 @f2(i32 %x, i1 %cmp) {
%res.3 = add i1 %res.2, %c.4
ret i1 %res.3
}
+
+define i1 @f3(i1 %c) {
+; CHECK-LABEL: define i1 @f3(
+; CHECK-SAME: i1 [[C:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C]], i64 0, i64 1
+; CHECK-NEXT: br i1 [[C]], label %[[T:.*]], label %[[E:.*]]
+; CHECK: [[T]]:
+; CHECK-NEXT: ret i1 true
+; CHECK: [[E]]:
+; CHECK-NEXT: ret i1 true
+;
+entry:
----------------
fhahn wrote:
could you add a test with non-constant operands? I think we may run into a potential issue if one of the select arms may be `undef` (I think for predicates we use `MayIncludeUndefOrPoison=false`, which may not hold for selects I think).
I think we also need a test case for vector selects; I think SCCP won't handle those correctly at the moment
https://github.com/llvm/llvm-project/pull/229613
More information about the llvm-commits
mailing list