[PATCH] D88367: [LLVM-C] Turn a ShuffleVector Constant Into a Getter.

Robert Widmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 26 16:33:55 PDT 2020


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG55f727306e72: [LLVM-C] Turn a ShuffleVector Constant Into a Getter. (authored by CodaFi).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88367

Files:
  llvm/include/llvm-c/Core.h
  llvm/lib/IR/Core.cpp
  llvm/tools/llvm-c-test/echo.cpp


Index: llvm/tools/llvm-c-test/echo.cpp
===================================================================
--- llvm/tools/llvm-c-test/echo.cpp
+++ llvm/tools/llvm-c-test/echo.cpp
@@ -809,7 +809,7 @@
         unsigned NumMaskElts = LLVMGetNumMaskElements(Src);
         for (unsigned i = 0; i < NumMaskElts; i++) {
           int Val = LLVMGetMaskValue(Src, i);
-          if (Val == LLVMUndefMaskElem) {
+          if (Val == LLVMGetUndefMaskElem()) {
             MaskElts.push_back(LLVMGetUndef(LLVMInt64Type()));
           } else {
             MaskElts.push_back(LLVMConstInt(LLVMInt64Type(), Val, true));
Index: llvm/lib/IR/Core.cpp
===================================================================
--- llvm/lib/IR/Core.cpp
+++ llvm/lib/IR/Core.cpp
@@ -3963,9 +3963,8 @@
   ShuffleVectorInst *I = cast<ShuffleVectorInst>(P);
   return I->getMaskValue(Elt);
 }
-const int LLVMUndefMaskElem =
-    -1; // not actually accessible as ShuffleVectorInst::UndefMaskElem, so we
-        // hardcode it here
+
+int LLVMGetUndefMaskElem(void) { return UndefMaskElem; }
 
 LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst) {
   Value *P = unwrap<Value>(AtomicInst);
Index: llvm/include/llvm-c/Core.h
===================================================================
--- llvm/include/llvm-c/Core.h
+++ llvm/include/llvm-c/Core.h
@@ -3942,13 +3942,20 @@
  */
 unsigned LLVMGetNumMaskElements(LLVMValueRef ShuffleVectorInst);
 
+/**
+ * \returns a constant that specifies that the result of a \c ShuffleVectorInst
+ * is undefined.
+ */
+int LLVMGetUndefMaskElem(void);
+
 /**
  * Get the mask value at position Elt in the mask of a ShuffleVector
- * instruction. Return LLVMUndefMaskElem if the mask value is undef at that
- * position.
+ * instruction.
+ *
+ * \Returns the result of \c LLVMGetUndefMaskElem() if the mask value is undef
+ * at that position.
  */
 int LLVMGetMaskValue(LLVMValueRef ShuffleVectorInst, unsigned Elt);
-extern const int LLVMUndefMaskElem;
 
 LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst);
 void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst, LLVMBool SingleThread);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88367.294525.patch
Type: text/x-patch
Size: 2121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200926/42b5a139/attachment.bin>


More information about the llvm-commits mailing list