[PATCH] D155726: [InstCombine] Test case for D155718+D154064

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 12:18:28 PDT 2023


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/icmp-fold-into-phi.ll:97
+declare zeroext i1 @StrCmp(ptr noundef, ptr noundef)
+declare zeroext i1 @CheckCond()
----------------
This test looks too complicated for what we actually want to test. I think something like this should be sufficient:
```
define i1 @test(i32 %x, i32 %y) {
entry:
  switch i32 %x, label %bb1 [
    i32 0, label %bb2
    i32 1, label %bb3
  ]

bb1:
  br label %bb2

bb2:
  %phi1 = phi i32 [ 1, %entry ], [ %y, %bb1 ]
  br label %bb3

bb3:
  %phi2 = phi i32 [ %phi1, %bb2 ], [ 0, %entry ]
  %cmp = icmp ugt i32 %phi2, 1
  ret i1 %cmp
}
```
This would also make it independent of D154064 and allow us to land this patch first.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155726/new/

https://reviews.llvm.org/D155726



More information about the llvm-commits mailing list