[llvm] [llvm][CodeGen] Added a check in CodeGenPrepare::optimizeSwitchType (PR #83322)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 13:23:42 PST 2024


================
@@ -7397,7 +7397,19 @@ bool CodeGenPrepare::optimizeSwitchType(SwitchInst *SI) {
     if (Arg->hasZExtAttr())
       ExtType = Instruction::ZExt;
   }
-
+  // If Cond has 2 users and one of them is a sext don't use a zext.
----------------
preames wrote:

We should probably be looking at the other user and using it's extend kind (sign or zero).

we probably do want the argument extend kind check to overrule, so maybe put this just above?

https://github.com/llvm/llvm-project/pull/83322


More information about the llvm-commits mailing list