[llvm] 9404d44 - [llvm-stress] Support opaque pointers
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 3 00:59:45 PST 2022
Author: Nikita Popov
Date: 2022-03-03T09:59:06+01:00
New Revision: 9404d4429921f568fd60eee8f1975a94b8c3f67a
URL: https://github.com/llvm/llvm-project/commit/9404d4429921f568fd60eee8f1975a94b8c3f67a
DIFF: https://github.com/llvm/llvm-project/commit/9404d4429921f568fd60eee8f1975a94b8c3f67a.diff
LOG: [llvm-stress] Support opaque pointers
With opaque pointers, generate the load/store type independently
of the pointer type.
Added:
Modified:
llvm/tools/llvm-stress/llvm-stress.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp
index 9135d60fdf925..46eb8c7026637 100644
--- a/llvm/tools/llvm-stress/llvm-stress.cpp
+++ b/llvm/tools/llvm-stress/llvm-stress.cpp
@@ -347,8 +347,10 @@ struct LoadModifier: public Modifier {
void Act() override {
// Try to use predefined pointers. If non-exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
- Value *V = new LoadInst(Ptr->getType()->getPointerElementType(), Ptr, "L",
- BB->getTerminator());
+ Type *Ty = Ptr->getType()->isOpaquePointerTy()
+ ? pickType()
+ : Ptr->getType()->getNonOpaquePointerElementType();
+ Value *V = new LoadInst(Ty, Ptr, "L", BB->getTerminator());
PT->push_back(V);
}
};
@@ -360,14 +362,16 @@ struct StoreModifier: public Modifier {
void Act() override {
// Try to use predefined pointers. If non-exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
- Value *Val = getRandomValue(Ptr->getType()->getPointerElementType());
- Type *ValTy = Val->getType();
+ Type *ValTy = Ptr->getType()->isOpaquePointerTy()
+ ? pickType()
+ : Ptr->getType()->getNonOpaquePointerElementType();
// Do not store vectors of i1s because they are unsupported
// by the codegen.
if (ValTy->isVectorTy() && ValTy->getScalarSizeInBits() == 1)
return;
+ Value *Val = getRandomValue(ValTy);
new StoreInst(Val, Ptr, BB->getTerminator());
}
};
More information about the llvm-commits
mailing list