[llvm] r275344 - Move a transform from InstCombine to InstSimplify.

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 16:32:53 PDT 2016


Author: majnemer
Date: Wed Jul 13 18:32:53 2016
New Revision: 275344

URL: http://llvm.org/viewvc/llvm-project?rev=275344&view=rev
Log:
Move a transform from InstCombine to InstSimplify.

This transform doesn't require any new instructions, it can safely live
in InstSimplify.

Modified:
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=275344&r1=275343&r2=275344&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Wed Jul 13 18:32:53 2016
@@ -3991,6 +3991,15 @@ static Value *SimplifyIntrinsic(Function
                                   Q.DL);
   }
 
+  // Simplify calls to llvm.masked.load.*
+  if (IID == Intrinsic::masked_load) {
+    IterTy MaskArg = ArgBegin + 2;
+    // If the mask is all zeros, the "passthru" argument is the result.
+    if (auto *ConstMask = dyn_cast<Constant>(*MaskArg))
+      if (ConstMask->isNullValue())
+        return ArgBegin[3];
+  }
+
   // Perform idempotent optimizations
   if (!IsIdempotent(IID))
     return nullptr;

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=275344&r1=275343&r2=275344&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Wed Jul 13 18:32:53 2016
@@ -1044,10 +1044,6 @@ static Value *simplifyMaskedLoad(const I
   if (!ConstMask)
     return nullptr;
 
-  // If the mask is all zeros, the "passthru" argument is the result.
-  if (ConstMask->isNullValue())
-    return II.getArgOperand(3);
-
   // If the mask is all ones, this is a plain vector load of the 1st argument.
   if (ConstMask->isAllOnesValue()) {
     Value *LoadPtr = II.getArgOperand(0);




More information about the llvm-commits mailing list