[PATCH] Check for all known bits on ret in InstCombine

Chandler Carruth chandlerc at gmail.com
Thu Jul 17 12:06:34 PDT 2014


This patch seems trivially fine once we sort out invariants. However, I wonder about doing something more comprehensive. No need to wait for that to make basic improvements here, but something to think about.

================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:1935-1936
@@ -1926,1 +1934,4 @@
 
+  // There might be invariants dominating this return that completely determine
+  // the value. If so, constant fold it.
+  unsigned BitWidth = VTy->getPrimitiveSizeInBits();
----------------
I wonder if it makes sense to do something somewhat more pervasive by replacing all uses of a value? Essentially, an invariant constant propagation pass.

http://reviews.llvm.org/D4567






More information about the llvm-commits mailing list