================
@@ -16,11 +16,15 @@ define i32 @test_asr(i32 %a, i32 %b) {
 ; CHECK-NEXT:    [[C:%.*]] = icmp slt i32 [[A]], 0
 ; CHECK-NEXT:    br i1 [[C]], label [[BB2:%.*]], label [[BB3:%.*]]
 ; CHECK:       bb2:
+; CHECK-NEXT:    [[NOT:%.*]] = xor i32 [[A]], -1
+; CHECK-NEXT:    [[D:%.*]] = lshr i32 [[NOT]], [[B]]
+; CHECK-NEXT:    [[NOT2:%.*]] = xor i32 [[D]], -1
----------------
nikic wrote:

However, the remaining pattern is already handled by an extra 
simplifycfg+instcombine run, because we have this select fold: 
https://github.com/llvm/llvm-project/blob/d222fa4521531cc4ac14b8e157d231c108c003be/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L656

I've adjusted the test to check for the combination of the three passes, to 
show that it folds in that case. But I'd also be open to add a variant of this 
fold for phi nodes rather than selects, if you think it's necessary.

https://github.com/llvm/llvm-project/pull/73662
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to