File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,14 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) {
228228 PtrDepth++;
229229 Ty = Ty->getPointeeType ()->getBaseElementTypeUnsafe ();
230230 } while (Ty->isPointerType ());
231+
232+ // While there are no special rules in the standards regarding void pointers
233+ // and strict aliasing, emitting distinct tags for void pointers break some
234+ // common idioms and there is no good alternative to re-write the code
235+ // without strict-aliasing violations.
236+ if (Ty->isVoidType ())
237+ return AnyPtr;
238+
231239 assert (!isa<VariableArrayType>(Ty));
232240 // When the underlying type is a builtin type, we compute the pointee type
233241 // string recursively, which is implicitly more forgiving than the standards
You can’t perform that action at this time.
0 commit comments